What it means
kubectl reads the cluster address and credentials from a kubeconfig. When it finds none, it tries http://localhost:8080, where nothing listens. The cluster is usually fine: kubectl just doesn't know where it is.
Causes and fixes
Most likely first. Run the check, and if it matches, apply the fix.
1. No kubeconfig for this user (running as another user, or with sudo)
Check:
echo $KUBECONFIG
ls -l ~/.kube/config
Fix: Copy the admin kubeconfig to ~/.kube/config (owned by you), or export KUBECONFIG.
2. The kubeconfig points at the wrong server, context or certificate
Check:
kubectl config view --minify
Fix: Fix the server URL or switch context with kubectl config use-context.
Fix it yourself
A live machine in your browser with this problem already on it. The grader checks the result.
Open the labNo account needed for your first tries.
Related errors
- Unable to connect to the server: x509: certificate signed by unknown authority
kubectl doesn't trust the API server's certificate, or the certificate doesn't cover the address used.
- Error from server (Forbidden): pods is forbidden: User cannot list resource
The user or ServiceAccount is authenticated but RBAC doesn't allow the action.