Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Created November 19, 2018 20:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save vfarcic/b6ed77d257964fa2e19c2722739ddad6 to your computer and use it in GitHub Desktop.
Save vfarcic/b6ed77d257964fa2e19c2722739ddad6 to your computer and use it in GitHub Desktop.
#####################
# Create The Cluster #
######################
# 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
mkdir -p cluster
eksctl create cluster \
-n devops24 \
--kubeconfig cluster/kubecfg-eks \
--node-type t2.medium \
--nodes 3
export KUBECONFIG=$PWD/cluster/kubecfg-eks
###################
# Install Ingress #
###################
kubectl apply \
-f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml
kubectl apply \
-f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/aws/service-l4.yaml
kubectl apply \
-f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/aws/patch-configmap-l4.yaml
#######################
# Destroy the cluster #
#######################
LB_NAME=$(aws elb \
describe-load-balancers \
| jq -r \
".LoadBalancerDescriptions[0] \
| select(.SourceSecurityGroup.GroupName \
| contains (\"k8s-elb\")) \
.LoadBalancerName")
aws elb delete-load-balancer \
--load-balancer-name $LB_NAME
eksctl delete cluster -n devops24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment