$ kubectl get pod -A
error: You must be logged in to the server (Unauthorized)
E0607 15:43:21.807301 1 token_review_endpoint.go:94] Invalid token: failed to validate JWT
vSphere with Tanzu
The unauthorized error occurs due to a known issue, where a guest cluster and its supervisor cluster have not synced changes in vCenter Server public keys.
This issue is known to occur after renewing vCenter certificates or if the vCenter public keys change.
Fix:
The fix is included in TKr 1.31.1 and higher versions.
Workaround:
The vCenter Server public keys are stored in the configmap “vc-public-keys” on the supervisor cluster. These keys are synced to the configmap “guest-cluster-auth-svc-public-keys” on the TKGS cluster(TKC).
The guest-cluster-auth-svc pods need to be restarted to update the changes in the configmap(ie. vc public keys, tls server certificate, or tls private key), “guest-cluster-auth-svc-public-keys”.
So, restart all the guest-cluster-auth-svc pods on the TKGS cluster.
You can also delete the existing guest-cluster-auth-svc pods by following the below steps. The deleted pods will be re-created with new keys.
export KUBECONFIG=/etc/kubernetes/admin.confkubectl get pods -A | grep cluster-auth -w kubectl delete pod -n vmware-system-auth guest-cluster-auth-svc-xxxxkubectl get pods -A | grep cluster-auth -wIt is known below condition also shows the same symptom:
guest-cluster-auth-svc-key) is renewed by cert-manager - if a user manually deletes the issuer resource '<cluster-name>-extensions-ca-issuer' or the secret resource '<cluster-name>-auth-svc-cert' in Supervisor, tkg-controller will recreate them. How to access the guest-cluster-auth-svc pods on the TKC: