API writes start failing cluster-wide with "etcdserver: mvcc: database space exceeded". Deploys, scaling and even leader election stop working.
AdvancedTroubleshootingKubernetes cluster-level
Answer
Likely causes → etcd hit its backend quota (2 GiB by default, 8 GiB recommended max) and raised a NOSPACE alarm, making the cluster read-only. Triggers: no compaction or defragmentation, or a controller writing huge numbers of objects or revisions (event floods, giant ConfigMaps, a CRD controller in a hot loop).
Diagnose →
ETCDCTL_API=3 etcdctl --endpoints=$EP --cacert=ca.crt --cert=etcd.crt --key=etcd.key endpoint status -w table
etcdctl alarm list
etcdctl get / --prefix --keys-only | cut -d/ -f3 | sort | uniq -c | sort -nr | head
Fix → Take a snapshot first, then compact, defragment each member one at a time, and clear the alarm:
etcdctl snapshot save /backup/etcd-$(date +%F).db
rev=$(etcdctl endpoint status -w json | jq '.[0].Status.header.revision')
etcdctl compact $rev
etcdctl defrag --endpoints=$EP1 # repeat per member
etcdctl alarm disarm
Then stop whatever was flooding writes.
Prevent → Keep the apiserver's automatic compaction on, schedule defrag, alert on etcd_mvcc_db_total_size_in_bytes above 70% of --quota-backend-bytes, and cap event TTLs. On managed clusters, open a ticket and find the object flood.
More on Kubernetes cluster-level
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?"BeginnerA 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`.Intermediate