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:
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
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.
export KUBECTL_VSPHERE_PASSWORD=supersecretpassword123
Log into supervisor cluster and verify cluster is healthy
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
---
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
kubectl apply -f guest_cluster_tkgs.yaml
kubectl get cluster ### View the cluster status
kubectl get tanzukubernetescluster ### View the cluster status