Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Created October 8, 2018 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vfarcic/3dfc71dc687de3ed98e8f804d7abba0b to your computer and use it in GitHub Desktop.
Save vfarcic/3dfc71dc687de3ed98e8f804d7abba0b to your computer and use it in GitHub Desktop.
######################
# Create The Cluster #
######################
# Make sure that you're using eksctl v0.1.5+.
# Follow the instructions from https://github.com/weaveworks/eksctl to intall eksctl.
export AWS_ACCESS_KEY_ID=[...] # Replace [...] with AWS access key ID
export AWS_SECRET_ACCESS_KEY=[...] # Replace [...] with AWS secret access key
export AWS_DEFAULT_REGION=us-west-2
export NAME=devops25
mkdir -p cluster
eksctl create cluster \
-n $NAME \
-r $AWS_DEFAULT_REGION \
--kubeconfig cluster/kubecfg-eks \
--node-type t2.small \
--nodes 3 \
--nodes-max 9 \
--nodes-min 3
export KUBECONFIG=$PWD/cluster/kubecfg-eks
##################
# Install Tiller #
##################
kubectl create \
-f https://raw.githubusercontent.com/vfarcic/k8s-specs/master/helm/tiller-rbac.yml \
--record --save-config
helm init --service-account tiller
kubectl -n kube-system \
rollout status deploy tiller-deploy
##################
# Metrics Server #
##################
helm install stable/metrics-server \
--name metrics-server \
--version 2.0.2 \
--namespace metrics
kubectl -n metrics \
rollout status \
deployment metrics-server
#######################
# Destroy the cluster #
#######################
IAM_ROLE=$(aws iam list-roles \
| jq -r ".Roles[] \
| select(.RoleName \
| startswith(\"eksctl-$NAME-nodegroup-0-NodeInstanceRole\")) \
.RoleName")
echo $IAM_ROLE
aws iam delete-role-policy \
--role-name $IAM_ROLE \
--policy-name $NAME-AutoScaling
eksctl delete cluster -n devops25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment