Skip to content

Instantly share code, notes, and snippets.

@Atabek-cyber
Forked from vfarcic/gke.sh
Created December 23, 2023 03:19
Show Gist options
  • Save Atabek-cyber/fd591fd0ced1b424871dcd9a7a68b118 to your computer and use it in GitHub Desktop.
Save Atabek-cyber/fd591fd0ced1b424871dcd9a7a68b118 to your computer and use it in GitHub Desktop.

Revisions

  1. @vfarcic vfarcic revised this gist Jan 26, 2020. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions gke.sh
    Original file line number Diff line number Diff line change
    @@ -10,9 +10,10 @@ gcloud auth login

    export PROJECT_ID=[...] # Replace [...] with the ID of the project

    gcloud container get-server-config
    gcloud container get-server-config \
    --region us-east1

    export VERSION=[...] # Replace [...] with k8s version. Make sure that it is v1.14+.
    export VERSION=[...] # Replace [...] with k8s version from the `validMasterVersions` section. Make sure that it is v1.14+.

    gcloud container clusters \
    create chaos \
  2. @vfarcic vfarcic revised this gist Jan 16, 2020. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions gke.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # Source: https://gist.github.com/2351032b5031ba3420d2fb9a1c2abd7e

    ######################
    # Create The Cluster #
    ######################
    @@ -8,9 +10,14 @@ gcloud auth login

    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 chaos \
    --project $PROJECT_ID \
    --cluster-version $VERSION \
    --zone us-east1-b \
    --machine-type n1-standard-4 \
    --num-nodes 1
  3. @vfarcic vfarcic created this gist Jan 12, 2020.
    37 changes: 37 additions & 0 deletions gke.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    ######################
    # 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 clusters \
    create chaos \
    --project $PROJECT_ID \
    --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)

    #######################
    # 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)")