Interview Prep/Monitoring & Observability/Kubernetes Monitoring, Scale & Cloud

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; exclude WATCH and CONNECT, which are long-lived.
  • apiserver_current_inflight_requests and APF metrics (apiserver_flowcontrol_rejected_requests_total): overload and throttling.

etcd

  • etcd_server_has_leader (must be 1) and etcd_server_leader_changes_seen_total.
  • etcd_disk_wal_fsync_duration_seconds_bucket (p99 should be under ~10 ms) and etcd_disk_backend_commit_duration_seconds_bucket.
  • etcd_mvcc_db_total_size_in_bytes against the quota (default 2 GiB; at quota etcd raises the NOSPACE alarm 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.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Kubernetes Monitoring, Scale & Cloud