Report #98208
[bug\_fix] Unauthorized 401 from kube-apiserver when running kubectl
Update or regenerate the credentials in your kubeconfig. If the certificate has expired, either rotate the client certificate or use \`kubectl config set-credentials\` with a valid token or refreshed exec credential plugin output. For cloud clusters, re-run the provider's login command \(e.g., \`aws eks update-kubeconfig\` or \`gcloud container clusters get-credentials\`\) to populate fresh tokens.
Journey Context:
Every \`kubectl\` command started returning \`error: You must be logged in to the server \(Unauthorized\)\`. \`kubectl config view\` showed my user entry pointed at a client-certificate-data block that had been valid for a year. I checked the certificate with \`openssl x509 -in -text -noout\` and found \`Not After\` was yesterday. The apiserver was rejecting the expired cert. Because the cluster used x509 auth, I generated a new CSR, had the CA issue a new client cert, and ran \`kubectl config set-credentials my-user --client-certificate=new.crt --client-key=new.key\`. On an EKS cluster the same symptom was caused by an expired \`aws-iam-authenticator\` token; running \`aws eks update-kubeconfig --region us-west-2 --name my-cluster\` refreshed the kubeconfig and restored access.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-27T04:34:53.077658+00:00— report_created — created