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 steps. 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:
Change to the directory with your GKE on AWS configuration. You created this directory when Installing the management service.
cd anthos-aws
To open the tunnel, run the
bastion-tunnel.sh
script. The tunnel forwards tolocalhost: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.
Open a new terminal and change into your
anthos-aws
directory.cd anthos-aws
Check that you're able to connect to the cluster with
kubectl
.env HTTPS_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 a user cluster, perform the following steps:
From your
anthos-aws
directory, useanthos-gke
to switch context to your user cluster. Replace CLUSTER_NAME with your user cluster name.cd anthos-aws env HTTPS_PROXY=http://localhost:8118 \ anthos-gke aws clusters get-credentials CLUSTER_NAME
Delete any Load balancers Ingress, or PersistentVolumeClaim resources you created.
Use the following
kubectl
command to check if there are any remaining load balancer Services on your user cluster:env HTTPS_PROXY=http://localhost:8118 \ kubectl get services
Use the following
kubectl
command to check if there are any remaining PersistentVolumeClaims on your user cluster:env HTTPS_PROXY=http://localhost:8118 \ kubectl get persistentvolumeclaim
Use
kubectl delete
to delete any remaining Services or PersistentVolumeClaims you created. For example, to delete the LoadBalancermy-lb-service
, run the following command:env HTTPS_PROXY=http://localhost:8118 \ kubectl delete service my-lb-service
For example, to delete the PersistentVolumeClaims
my-pvc
, run the following command:env HTTPS_PROXY=http://localhost:8118 \ kubectl delete persistentvolumeclaim my-pvc
From your
anthos-aws
directory, useanthos-gke
to switch context to your management service.cd anthos-aws anthos-gke aws management get-credentials
Delete all AWSNodePools with
kubectl
.env HTTPS_PROXY=http://localhost:8118 \ kubectl delete AWSNodePool --all
Delete all AWSCluster with
kubectl
.env HTTPS_PROXY=http://localhost:8118 \ kubectl delete AWSCluster --all
Removing a management service
You use anthos-gke
to delete the management service.
Change directory to the folder you created during installation.
Use
anthos-gke
to delete resources for the management service.env HTTP_PROXY=http://localhost:8118 \ anthos-gke aws management delete
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:
To find the bucket's name, find the value of
gcs_download_bucket
interraform-workspace/terraform.tfvars.json
withgrep
.grep agent_s3_bucket terraform.tfvars.json
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