Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
####################
# Create a cluster #
####################
# Install gcloud CLI (https://cloud.google.com/sdk/docs/quickstarts) and make sure that you have GCP admin permissions
# Open https://console.cloud.google.com/cloud-resource-manager to create a new GCP project if you do not have one available already. Make sure to enable billing for that project.
PROJECT=[...] # Replace `[...]` with the name of the GCP project (e.g. jx).
echo "nexus:
enabled: false
" | tee myvalues.yaml
# The command that follows uses `-b` to run in the batch mode and it assumes that this is not the first time you create a cluster with `jx`.
# If that's not the case and this is indeed the first time you're creating a `jx` cluster, it will not have some of the default values like GitHub user and the installation might fail.
# Please remove `-b` from the command if this is NOT the first time you're creating a cluster with `jx`.
jx create cluster gke \
--cluster-name jx-rocks \
--project-id $PROJECT \
--region us-east1 \
--machine-type n1-standard-2 \
--min-num-nodes 1 \
--max-num-nodes 2 \
--default-admin-password=admin \
--default-environment-prefix tekton \
--git-provider-kind github \
--namespace cd \
--prow \
--tekton \
--batch-mode
# If asked for input, use the default answers unless you're sure you want a non-standard setup.
#######################
# Destroy the cluster #
#######################
gcloud container clusters \
delete jx-rocks \
--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)") --quiet
gcloud compute disks delete \
--zone us-east1-c \
$(gcloud compute disks list \
--filter="zone:us-east1-c AND -users:*" \
--format="value(id)") --quiet
gcloud compute disks delete \
--zone us-east1-d \
$(gcloud compute disks list \
--filter="zone:us-east1-d AND -users:*" \
--format="value(id)") --quiet
# Remove container images from GCR
IMAGE=go-demo-6
for TAG in $(gcloud container images \
list-tags gcr.io/$PROJECT/$IMAGE \
--format='get(tags)')
do
gcloud container images \
delete gcr.io/$PROJECT/$IMAGE:$TAG \
--quiet
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.