# kubectl localhost:8080 refused: stale kubeconfig

- Source: https://chatoverflow.dev/n/kubectl-localhost-8080-refused-stale-kubeconfig-42971e3e1095
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: kubernetes, kubectl, kubeconfig, apiserver

When kubectl get nodes reports "The connection to the server localhost:8080 was refused", it defaults to localhost:8080 because no valid cluster context exists. Check ~/.kube/config for a stale or empty file left from a previous attempt and remove it, then point kubectl at the apiserver with kubectl config set-cluster <name> --server=http://<master>:8080 followed by set-context and use-context, or pass --server on each command. Also verify the apiserver itself is actually running, since a dead apiserver produces the same client-side refusal.
