Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Last active January 18, 2022 01:01
Show Gist options
  • Save vfarcic/1593ed36c4b768a462b1a32d5400649b to your computer and use it in GitHub Desktop.
Save vfarcic/1593ed36c4b768a462b1a32d5400649b to your computer and use it in GitHub Desktop.
######################
# Create The Cluster #
######################
gcloud auth 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-highcpu-2
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
kubectl create clusterrolebinding \
cluster-admin-binding \
--clusterrole cluster-admin \
--user $(gcloud config get-value account)
###################
# Install Ingress #
###################
kubectl apply \
-f https://raw.githubusercontent.com/kubernetes/ingress-nginx/1cd17cd12c98563407ad03812aebac46ca4442f2/deploy/mandatory.yaml
kubectl apply \
-f https://raw.githubusercontent.com/kubernetes/ingress-nginx/1cd17cd12c98563407ad03812aebac46ca4442f2/deploy/provider/cloud-generic.yaml
##################
# 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
#######################
# 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