CDM Removal: GKE

To remove the CDM from GKE when you’re done working with it:

  1. Run the skaffold delete command to shut down your deployment and remove it from your namespace. For example:

    $ cd /path/to/forgeops
    $ skaffold delete --profile small
    Cleaning up…​
    . . .
  2. Remove your cluster:

    1. Change to the directory that contains the cluster removal script:

      $ cd /path/to/forgeops/cluster/gke
    2. Source the script that contains the configuration for your cluster size. For example:

      $ source ./small.sh
    3. Run the cluster removal script:

      $ ./cluster-down.sh
      The "small" cluster will be deleted. This action cannot be undone.
      Press any key to continue, or CTRL+C to quit
      1. Press Enter to proceed with cluster and data removal.

        Getting the cluster credentials for small in Zone my-region-a
        Fetching cluster endpoint and auth data.
        kubeconfig entry generated for small.
        Do you want to delete all PVCs allocated by this
        cluster (recommended for dev clusters)? [Y/N]
      2. Enter Y to confirm that you want to remove all the data created by this cluster, or enter N if you don’t want to delete the data.

        Draining all nodes
        node/gke-small-default-pool-05ac2046-c1xd cordoned
        node/gke-small-default-pool-5dd53b95-mr80 cordoned
        node/gke-small-default-pool-e835e4bb-0gwp cordoned
        . . .
        The following clusters will be deleted.
         - [small] in [my-region]
        Deleting cluster small…​done.
        Deleted [https://container.googleapis.com/v1/projects/my-project/zones/my-region/clusters/small].
        Check your GCP console for any orphaned project resources such as disks!
  3. Run the kubectx command.

    The Kubernetes context for the CDM cluster should not appear in the kubectx command output.

Use the Google Cloud Console to review your use of resources such as Compute Engine disks, static IP addresses, load balancers, and storage buckets. Avoid unnecessary charges by deleting resources that you’re no longer using.