Now that we have the supervisor cluster up and running and our namespace created, we can deploy a guest cluster via the CLI. I installed an ubuntu 20 vm in vCenter for use as my jumpbox. I installed kubectl and the vsphere plugin in this environment. There are windows plugins and plugins for all the linux distros as well.
Install kubectl and vsphere plugin on jump server
Kubectl
You can download and install kubectl very easily (in linux) with these commands:
1 2 3 4 | curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" sudo mv kubectl /usr/local/bin/kubectl sudo chmod +x /usr/local/bin/kubectl kubectl version |
vSphere Plugin
The easiest way to download this is to navigate to the supervisor cluster’s floating IP address. In my case it is 10.10.4.13
![](https://mattadam.com/wp-content/uploads/2021/07/image-94-1024x602.png)
1 2 3 | sudo mv kubectl-vsphere /usr/local/bin/kubectl-vsphere sudo chmod +x /usr/local/bin/kubectl-vsphere kubectl vsphere |
Login to Supervisor Cluster
OPTIONAL: Set Environment variable for vsphere password.
1 | export KUBECTL_VSPHERE_PASSWORD=supersecretpassword123 |
Log into supervisor cluster and verify cluster is healthy
1 2 3 4 5 | kubectl vsphere login --vsphere-username administrator@vsphere. local --server=https: //10 .10.4.50 --insecure-skip-tls-verify kubectl config use-context dev kubectl get pods --all-namespaces ### Should see a list of all the pods running kubectl get nodes ### Everything should show Ready kubectl get tanzukubernetesreleases ###Checkout the latest releases |
Create yaml file to build guest cluster
Create a file called guest_cluster.yaml with the following content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | --- apiVersion: run.tanzu.vmware.com/v1alpha1 kind: TanzuKubernetesCluster metadata: name: tkg-cluster-01 spec: topology: controlPlane: count: 1 class: best-effort-small storageClass: vsan-default-storage-policy workers: count: 2 class: best-effort-small storageClass: vsan-default-storage-policy distribution: version: v1.20.7 |
Deploy TKGs guest cluster
1 2 3 | kubectl apply -f guest_cluster_tkgs.yaml kubectl get cluster ### View the cluster status kubectl get tanzukubernetescluster ### View the cluster status |
![](https://mattadam.com/wp-content/uploads/2021/07/image-90.png)
![](https://mattadam.com/wp-content/uploads/2021/07/image-91.png)
![](https://mattadam.com/wp-content/uploads/2021/07/image-92-1024x378.png)