What are the key metrics for the Kubernetes API server and etcd?
AdvancedConceptKubernetes Monitoring, Scale & Cloud
Answer
API server
apiserver_request_total{code, verb, resource}: error rates (5xx, 429).apiserver_request_duration_seconds_bucket: latency per verb; excludeWATCHandCONNECT, which are long-lived.apiserver_current_inflight_requestsand APF metrics (apiserver_flowcontrol_rejected_requests_total): overload and throttling.
etcd
etcd_server_has_leader(must be 1) andetcd_server_leader_changes_seen_total.etcd_disk_wal_fsync_duration_seconds_bucket(p99 should be under ~10 ms) andetcd_disk_backend_commit_duration_seconds_bucket.etcd_mvcc_db_total_size_in_bytesagainst the quota (default 2 GiB; at quota etcd raises theNOSPACEalarm and rejects writes).
histogram_quantile(0.99, sum by (le, verb) (rate(apiserver_request_duration_seconds_bucket{verb!~"WATCH|CONNECT"}[5m])))
Slow etcd disks show up as slow API server writes across the whole cluster.
More on Kubernetes Monitoring, Scale & Cloud
What is kube-prometheus-stack and what does it install?BeginnerWhat CRDs does the Prometheus Operator provide?IntermediateHow does the Prometheus Operator decide which ServiceMonitors to load?IntermediateWhich cAdvisor container memory metric should you watch, and why?IntermediateHow do metrics-server and the custom/external metrics APIs relate to HPA?IntermediateWhich kube-state-metrics metrics do you use most?Beginner