Last active
January 18, 2022 00:42
-
-
Save vfarcic/80c379849b96f4ae5a2ccd30d843f205 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: https://gist.github.com/80c379849b96f4ae5a2ccd30d843f205 | |
###################### | |
# Create The Cluster # | |
###################### | |
gcloud auth login | |
# Open https://console.cloud.google.com/cloud-resource-manager to create a new project | |
export PROJECT_ID=[...] # Replace [...] with the ID of the project | |
gcloud container get-server-config | |
export VERSION=[...] # Replace [...] with k8s version. Make sure that it is v1.14+. | |
gcloud container clusters \ | |
create istio \ | |
--project $PROJECT_ID \ | |
--region us-east1 \ | |
--machine-type n1-standard-2 \ | |
--cluster-version=$VERSION \ | |
--enable-autoscaling \ | |
--num-nodes 1 \ | |
--max-nodes 3 \ | |
--min-nodes 1 | |
kubectl create clusterrolebinding \ | |
cluster-admin-binding \ | |
--clusterrole cluster-admin \ | |
--user $(gcloud config get-value account) | |
################# | |
# Install Istio # | |
################# | |
istioctl install --skip-confirmation | |
kubectl apply \ | |
--filename https://raw.githubusercontent.com/istio/istio/release-1.8/samples/addons/prometheus.yaml | |
####################### | |
# Destroy the cluster # | |
####################### | |
gcloud container clusters \ | |
delete istio \ | |
--project $PROJECT_ID \ | |
--region us-east1 \ | |
--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)") | |
gcloud compute disks delete \ | |
--zone us-east1-c \ | |
$(gcloud compute disks list \ | |
--filter="zone:us-east1-c AND -users:*" \ | |
--format="value(id)") | |
gcloud compute disks delete \ | |
--zone us-east1-d \ | |
$(gcloud compute disks list \ | |
--filter="zone:us-east1-d AND -users:*" \ | |
--format="value(id)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment