Kubernetes cluster authentication failure
April 30, 2026 ยท View on GitHub
Playbook ID: kubectl-auth
Category: auth
Severity: high
Tags: kubernetes, kubectl, auth, kubeconfig
What this failure means
kubectl could not authenticate with the Kubernetes API server. This prevents cluster operations such as apply, rollout, or get.
Common log signals
error: you must be logged in
You must be logged in to the server
unable to connect to the server
no configuration has been provided
error loading config file
context not found
kubectl cluster-info
Diagnosis
kubectl could not authenticate with the Kubernetes API server. This prevents cluster operations such as apply, rollout, or get.
Fix steps
- Decode and export the kubeconfig from the CI secret:
echo "$KUBECONFIG_B64" | base64 -d > ~/.kube/config && chmod 600 ~/.kube/config. - Verify the active context and cluster endpoint with
kubectl config current-context && kubectl config view --minify. - Test connectivity before deploy steps with
kubectl cluster-info. - For expired certificate credentials, regenerate the kubeconfig from the cloud provider CLI.
- For service account token auth, confirm the token is still valid and attached to the job context you expect.
- For RBAC errors immediately after auth succeeds, switch to the
k8s-rbac-forbiddendiagnosis instead.
Validation
kubectl cluster-infosucceeds.kubectl auth whoamior an equivalent access check confirms the expected identity.kubectl get pods -n <namespace> --request-timeout=10sreturns successfully.
Likely files to inspect
.github/workflows/*.yml.gitlab-ci.ymlkubeconfigk8s/**/*.yaml
Run Faultline
faultline analyze build.log
faultline explain kubectl-auth
faultline workflow build.log --json --mode agent
Search phrases this page answers
- Kubernetes cluster authentication failure
- Auth: kubernetes cluster authentication failure
- You must be logged in to the server
- faultline explain kubectl-auth
- Kubernetes kubernetes cluster authentication failure
Generated from playbooks/bundled/log/auth/kubectl-auth.yaml. Do not edit directly โ run make docs-generate.