-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathsetup-eks-cluster.sh
49 lines (33 loc) · 1.27 KB
/
setup-eks-cluster.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
#
# AUTHOR: Paulo Monteiro @ New Relic - 2019-04
#
IFS=$'\n'
for VAR in $(egrep '^.+=' ./.env)
do
export $VAR
done
# publish your images
cd ~/${GITHUB_REPO}
docker login
docker-compose push
# install kubectl
curl -sLO https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin
# install heptio-authenticator-aws
curl -sLo heptio-authenticator-aws https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.3.0/heptio-authenticator-aws_0.3.0_linux_amd64
chmod +x heptio-authenticator-aws
sudo mv heptio-authenticator-aws /usr/local/bin
# configure the AWS cli
export AWS_REGION='us-west-2'
mkdir ~/.aws
printf "[default]\noutput = json\nregion = ${AWS_REGION}\n" > ~/.aws/config
aws configure
# install eksctl
curl -sL "https://github.com/weaveworks/eksctl/releases/download/latest_release/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
# create the basic EKS cluster (when done consider saving ~/.kube/config to a safe place)
eksctl create cluster --nodes 1 --region=${AWS_REGION} --name=${CLUSTER_NAME}
# check if everything is sound
kubectl get pods --all-namespaces --no-headers -o custom-columns=":metadata.name,:metadata.namespace"