Cannot run kubectl commands on the Supervisor cluster. Kubectl commands are failing with a credential error.
On the vCenter web UI under Workload Management, the below symptoms are observed:
Configured Control Plane VMs
Cluster <cluster id> is unhealthy: Get "http://localhost:1080/external-cert/http1/<supervisor control plane vm IP>/6443/version?timeout=2m0s": context deadline exceeded (Client.Timeout exceeded while awaiting headers).
System error occurred on Master node with identifier <master_node_ID>. Details: Failed to sync changes: Command '['/usr/bin/kubectl', '--kubeconfig', '/etc/kubernetes/admin.conf', 'get', 'daemonset', '--namespace', 'vmware-system-logging', '-o', 'json']' returned non-zero exit status1.. Will be retried..
The above error message indicates a failure to run a kubectl command while using the /etc/kubernetes/admin.conf file on the specified Supervisor control plane VM.
Failed to reconcile annotations on workload <namespace>
When running commands from the Supervisor cluster context or while SSH into a Supervisor control plane VM, the following symptoms are observed:
kubectl get pods -n <namespace>
EMMDD HH:MM:SS.ms #### memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
EMMDD HH:MM:SS.ms #### memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
EMMDD HH:MM:SS.ms #### memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
EMMDD HH:MM:SS.ms #### memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
EMMDD HH:MM:SS.ms #### memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
error: You must be logged in to the server (the server has asked for the client to provide credentials)
vSphere Supervisor
Kubectl commands will fail when the /etc/kubernetes/admin.conf file's certificates have expired.
System checks including health checks rely on using this file for running kubectl commands in the Supervisor cluster.
This file is located on each Supervisor control plane VM and will need to be individually checked for expiration.
#Checks that the admin.conf file's certificates are not expired
cat /etc/kubernetes/admin.conf | grep certificate-authority-data | awk '{print $2}' | base64 -d | openssl x509 -noout -text | grep After
cat /etc/kubernetes/admin.conf | grep client-certificate-data | awk '{print $2}' | base64 -d | openssl x509 -noout -text | grep After
kubeadm certs renew all
cat /etc/kubernetes/admin.conf | grep certificate-authority-data | awk '{print $2}' | base64 -d | openssl x509 -noout -text | grep After
cat /etc/kubernetes/admin.conf | grep client-certificate-data | awk '{print $2}' | base64 -d | openssl x509 -noout -text | grep After
/usr/lib/vmware-wcp/hypercrypt.py --reencrypt
crictl rm -f $(crictl ps --label io.kubernetes.container.name=kube-controller-manager -q)
crictl rm -f $(crictl ps --label io.kubernetes.container.name=kube-scheduler -q)
crictl rm -f $(crictl ps --label io.kubernetes.container.name=etcd -q)
crictl rm -f $(crictl ps --label io.kubernetes.container.name=kube-apiserver -q)
crictl ps | egrep "kube-|etcd"