VMware : How to identify the LEADER SupervisorControPlane in vSphere with Tanzu
In this post, we going to show you how you can connect to the supervisor cluster control plane nodes and identify the Leader for Kubernetes master within VMware vSphere with Tanzu. This is important for certain troubleshooting and analysis tasks.
As you maybe know the supervisor cluster is the Kubernetes cluster that we stand up inside of a vSphere cluster when enabling workload management.
The supervisor cluster like other Kubernetes clusters operates an active-passive multi-master model and only one master node is ever active and making the change on the cluster and if the leader goes down then these followers elect a new leader on the cluster.
The master node is responsible for cluster operation and has 4 essential components:
- Kube-apiserver
- Cluster store
- Kube-controller-manager
- Kube-scheduler
The below steps allow you to connect on one of the 3 supervisor cluster control plane VM and identify the leader:
STEP1: SSH to the vcenter appliance and then run the script to retrieve the supervisor control plane password
/usr/lib/vmware-wcp/decryptK8Pwd.py
STEP2: SSH to one on the 3 VM supervisor control plane using root username and the password provided from the previous command
STEP3: Get the details for the kube-scheduler or kube-controller-manager
kubectl get ep/kube-scheduler -n kube-system -o json
kubectl get ep/kube-controller-manager -n kube-system -o json
STEP4: Filter the current MASTER_LEADER_ID:
$ export MASTER_LEADER_ID=$(kubectl get ep/kube-scheduler -n kube-system -o json | jq -r .metadata.annotations[] | awk -F',' '{print $1}' | awk -F':' '{print $2}' | jq -r . | awk -F'_' '{print $1}')
$ echo $MASTER_LEADER_ID
Enjoy!