A new version of GKE on AWS was released on October 2. See the release notes for more information.

Uninstalling GKE on AWS

This topic describes how to uninstall GKE on AWS.

Before you begin

To perform these steps, authenticate to your GKE on AWS management service.

To connect to your GKE on AWS resources, perform the following directions. Select if you have an existing AWS VPC (or direct connection to your VPC) or created a dedicated VPC when creating your management service.

Existing VPC

If you have a direct or VPN connection to an existing VPC, omit the line env HTTP_PROXY=http://localhost:8118 from commands in this topic.

Dedicated VPC

When you create a management service in a dedicated VPC, GKE on AWS includes a bastion host in a public subnet.

To connect to your management service, perform the following steps:

  1. Change to the directory with your GKE on AWS configuration. You created this directory when Installing the management service.

    cd anthos-aws

  2. To open the tunnel, run the bastion-tunnel.sh script. The tunnel forwards to localhost:8118.

    To open a tunnel to the bastion host, run the following command:

    ./bastion-tunnel.sh -N
    

    Messages from the SSH tunnel appear in this window. When you are ready to close the connection, stop the process by using Control+C or closing the window.

  3. Open a new terminal and change into your anthos-aws directory.

    cd anthos-aws
  4. Check that you're able to connect to the cluster with kubectl.

    env HTTP_PROXY=http://localhost:8118 \
    kubectl cluster-info
    

    The output includes the URL for the management service API server.

Deleting user clusters

You use kubectl to delete user clusters. GKE on AWS gracefully shuts down all nodes. Pods receive a SIGTERM and then, after a grace period, a SIGKILL. After the pods stop, the management service starts removing AWS resources.

To delete your GKE on AWS cluster, perform the following steps:

  1. From your anthos-aws directory, use anthos-gke to switch context to your user cluster.

    cd anthos-aws
    env HTTP_PROXY=http://localhost:8118 \
    anthos-gke aws clusters get-credentials CLUSTER_NAME

  2. Delete any Load balancers Ingress, or PersistentVolumeClaim resources you created.

    1. You can check if there are any remaining load balancer Services on your GKE on AWS cluster with the following kubectl command:

      env HTTP_PROXY=http://localhost:8118 \
        kubectl get services
      
    2. You can check if there are any remaining PersistentVolumeClaims on your GKE on AWS cluster with the following kubectl command:

      env HTTP_PROXY=http://localhost:8118 \
        kubectl get persistentvolumeclaim
      
    3. Use kubectl delete to delete any remaining Services or PersistentVolumeClaims you created. For example, to delete the LoadBalancer my-lb-service, run the following command:

      env HTTP_PROXY=http://localhost:8118 \
        kubectl delete service my-lb-service
      

      For example, to delete the PersistentVolumeClaims my-pvc, run the following command:

      env HTTP_PROXY=http://localhost:8118 \
      kubectl delete persistentvolumeclaim my-pvc
      
  3. From your anthos-aws directory, use anthos-gke to switch context to your management service.

    cd anthos-aws
    anthos-gke aws management get-credentials

  4. Delete all AWSNodePools with kubectl.

    env HTTP_PROXY=http://localhost:8118 \
      kubectl delete AWSNodePool --all
    
  5. Delete all AWSCluster with kubectl.

    env HTTP_PROXY=http://localhost:8118 \
      kubectl delete AWSCluster --all
    

Removing a management service

You use anthos-gke to delete the management service.

  1. Change directory to the folder you created during installation.

  2. Use anthos-gke to delete resources for the management service.

    env HTTP_PROXY=http://localhost:8118 \
    anthos-gke aws management delete
    
  3. If you set HTTP_PROXY in an environment variable, use unset to remove it.

    unset HTTP_PROXY
    

Removing the AWS S3 bucket

When you create a management service, anthos-gke creates an S3 bucket on AWS with binaries for cluster creation. The bucket is reused when you create new user clusters. If you are no longer using GKE on AWS, you can remove the bucket after you delete your management service.

To delete the GKE on AWS S3 bucket, perform the following steps:

  1. To find the bucket's name, find the value of gcs_download_bucket in terraform-workspace/terraform.tfvars.json with grep.

    grep agent_s3_bucket terraform.tfvars.json
    
  2. Delete this s3 bucket and its contents with the aws command, replacing bucket-name with the name of your bucket from the previous command.

    aws s3 rb s3://bucket-name --force