Every `kubectl` command fails with "The connection to the server 10.0.1.10:6443 was refused - did you specify the right host or port?"
BeginnerTroubleshootingKubernetes cluster-level
Answer
Likely causes → Either kubectl points at the wrong endpoint (wrong context, stale kubeconfig after the cluster was recreated) or the API server really is down. On self-managed clusters the kube-apiserver static pod may be crash-looping because etcd is down, a certificate expired, or the control-plane disk is full.
Diagnose →
kubectl config current-context
kubectl config view --minify | grep server
nc -vz 10.0.1.10 6443
# on the control-plane node
sudo crictl ps -a | grep -E 'kube-apiserver|etcd'
sudo crictl logs $(sudo crictl ps -a --name kube-apiserver -q | head -1) 2>&1 | tail
df -h /var/lib/etcd
Fix → Switch to the right context (kubectl config use-context prod) or regenerate kubeconfig (aws eks update-kubeconfig --name prod). On kubeadm clusters fix whatever the apiserver logs complain about (etcd, certs, disk); kubelet restarts the static pod automatically.
Prevent → Use a managed control plane where possible, run 3 control-plane nodes, and monitor the API server endpoint with a blackbox probe.
More on Kubernetes cluster-level
A new deployment's pods stay Pending with "0/5 nodes are available: 5 Insufficient cpu. preemption: 0/5 nodes are available: 5 No preemption victims found for incoming pod."BeginnerPods are Pending, but Cluster Autoscaler won't add nodes; the pod events say "pod didn't trigger scale-up: 2 node(s) didn't match Pod's node affinity/selector, 1 max node group size reached".IntermediateA node goes NotReady and kubelet logs "PLEG is not healthy: pleg was last seen active 3m10s ago; threshold is 3m0s".IntermediateAfter a node was terminated, its pods have shown `Terminating` for two hours and their replacements aren't being created.IntermediateYou deleted a namespace an hour ago and it's still `Terminating`.IntermediateAPI writes start failing cluster-wide with "etcdserver: mvcc: database space exceeded". Deploys, scaling and even leader election stop working.Advanced