Uses Terraform to install Tanzu Kubernetes Grid management cluster in AWS.
See Deploy Management Clusters to Amazon EC2 with the CLI
Assumes:
- You have an AWS account with the Administrator role
- You have downloaded and installed the tkg CLI
- You have registered an SSH Public Key
cp terraform.tfvars.sample terraform.tfvars
Amend the values for
environment
aws_secret_key_id
aws_secret_access_key
aws_ssh_key_name
path_to_tkg_config_yaml
There are other variable values you can adjust. Peek at main.tf to see what's available.
./create-mgmt-cluster.sh
If you chose the
dev
plan the installation normally completes in less than 10 minutes.
./destroy-mgmt-cluster.sh
kubectl describe cluster-api -A --kubeconfig ~/.kube-tkg/tmp/{config}
Look for occurrences of "Error" or "Exception"
With tkg 1.2, attempting to delete the management cluster fails.
Here's the work-around...
- Download and install the 0.5.5 release of clusterawsadm. (Pick a binary suitable for the operating system that hosts your development or continuous integration environment.).
- Export the missing environment variable with
export AWS_B64ENCODED_CREDENTIALS=$(clusterawsadm alpha bootstrap encode-aws-credentials)
- Re-attempt to delete the management cluster with
tkg delete management-cluster {tkg_mgmt_cluster_name} --config {path_to_config_yaml_file}
The bootstrap cluster runs with kind.
If you have kind installed you can run
kind get clusters
then use the name of the cluster to delete it
kind delete clusters {name}
If you want to get back to clean initial state execute the following sequence of commands.
rm -Rf ~/.tkg ## Destroys all TKG configuration
rm -Rf ~/.kube ## Destroys all Kubernetes cluster context
rm -Rf ~/.kube-tkg ## Destroys all TKG bootstrap context
docker container prune ## Prunes all unused containers, reclaiming disk space
docker volume prune ## Prunes all unused volumes, reclaiming disk space
docker rmi registry.tkg.vmware.run/kind/node:{tag} ## Removes the container image used to provision TKG clusters
Consult the VMWare Tanzu Kubernetes Grid troubleshooting documentation