Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Last active December 23, 2023 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save vfarcic/924f817d340d4cc52d1c4dd0b300fd20 to your computer and use it in GitHub Desktop.
Save vfarcic/924f817d340d4cc52d1c4dd0b300fd20 to your computer and use it in GitHub Desktop.
# Source: https://gist.github.com/924f817d340d4cc52d1c4dd0b300fd20
######################
# Create The Cluster #
######################
gcloud auth login
# Open https://console.cloud.google.com/cloud-resource-manager to create a new project if you don't have one already
export PROJECT_ID=[...] # Replace [...] with the ID of the project
gcloud container get-server-config \
--region us-east1
export VERSION=[...] # Replace [...] with k8s version from the `validMasterVersions` section. Make sure that it is v1.14+.
gcloud container clusters \
create chaos \
--project $PROJECT_ID \
--cluster-version $VERSION \
--zone us-east1-b \
--machine-type n1-standard-4 \
--num-nodes 1
kubectl create clusterrolebinding \
cluster-admin-binding \
--clusterrole cluster-admin \
--user $(gcloud config get-value account)
#################
# Install Istio #
#################
istioctl manifest install \
--skip-confirmation
export INGRESS_HOST=$(kubectl \
--namespace istio-system \
get service istio-ingressgateway \
--output jsonpath="{.status.loadBalancer.ingress[0].ip}")
echo $INGRESS_HOST
# Repeat the `export` command if the output of `echo` is empty
#######################
# Destroy the cluster #
#######################
gcloud container clusters \
delete chaos \
--zone us-east1-b \
--quiet
# Remove unused disks to avoid reaching the quota (and save a bit of money)
gcloud compute disks delete \
--zone us-east1-b \
$(gcloud compute disks list \
--filter="zone:us-east1-b AND -users:*" \
--format="value(id)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment