Skip to content

Instantly share code, notes, and snippets.

@rrichards
Forked from vfarcic/gke.sh
Created May 29, 2018 00:48
Show Gist options
  • Save rrichards/16e9b57bd09bbe3d0ef65ba2bb7130f2 to your computer and use it in GitHub Desktop.
Save rrichards/16e9b57bd09bbe3d0ef65ba2bb7130f2 to your computer and use it in GitHub Desktop.
######################
# Create The Cluster #
######################
gcloud auth login
gcloud auth application-default login
ZONE=$(gcloud compute zones list \
--filter "region:(us-east1)" \
| awk '{print $1}' \
| tail -n 1)
ZONES=$(gcloud compute zones list \
--filter "region:(us-east1)" \
| tail -n +2 \
| awk '{print $1}' \
| tr '\n' ',')
MACHINE_TYPE=n1-standard-1
gcloud container clusters \
create devops24 \
--zone $ZONE \
--node-locations $ZONES \
--machine-type $MACHINE_TYPE \
--enable-autoscaling \
--num-nodes 1 \
--max-nodes 1 \
--min-nodes 1 \
--cluster-version "1.9.7-gke.1"
kubectl create clusterrolebinding \
cluster-admin-binding \
--clusterrole cluster-admin \
--user $(gcloud config get-value account)
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/cloud-generic.yaml
#######################
# Destroy the cluster #
#######################
gcloud container clusters \
delete devops24 \
--zone $ZONE \
--quiet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment