SadServers
  • Scenarios
  • Labs
    All Labs Linux & Bash Web Servers Databases Data Processing Docker Kubernetes CI/CD Infrastructure as Code Tooling / Applications
  • Dashboard
  • Solutions
    For Individuals For Businesses
  • Ranking
  • Newsletter
  • Documentation
    FAQ Support Pro Accounts Pro+ Accounts Business Accounts Gift API CLI/TUI Privacy Troubleshooting Interviews
  • Blog
  • Pricing
  • Gift
    Gift Purchase Gift Redeem
  • About
Log In - Sign Up
  1. Labs
  2. etcd
  3. Cheatsheet

Guide

Concepts and learning path

Troubleshooting

Failure modes and fixes

Cheatsheet

Commands to keep handy

etcd cheatsheet

etcdctl — environment

export ETCDCTL_API=3 export ETCDCTL_ENDPOINTS=https://127.0.0.1:2379 export ETCDCTL_CACERT=/etc/kubernetes/pki/etcd/ca.crt export ETCDCTL_CERT=/etc/kubernetes/pki/etcd/server.crt export ETCDCTL_KEY=/etc/kubernetes/pki/etcd/server.key

Key-value operations

CommandDescription
etcdctl put mykey myvalueWrite a key
etcdctl get mykeyRead a key
etcdctl get --prefix /registry/Prefix scan (K8s paths)
etcdctl del mykeyDelete a key
etcdctl watch mykeyStream changes to a key
etcdctl txn -iInteractive transaction

Cluster health

CommandDescription
etcdctl endpoint healthHealth per endpoint
etcdctl endpoint status -w tableLeader, revision, db size, alarms
etcdctl member list -w tableCluster members
etcdctl alarm listActive alarms (NOSPACE, CORRUPT)

Replication / Raft status

# Table: which member is leader, raft index, db size etcdctl endpoint status -w table # Check all endpoints (comma-separated) ETCDCTL_ENDPOINTS=https://node1:2379,https://node2:2379,https://node3:2379 \ etcdctl endpoint health --cluster

Maintenance

CommandDescription
etcdctl snapshot save /backup/snap.dbConsistent backup
etcdctl snapshot status /backup/snap.db -w tableVerify snapshot
etcdctl compact $(etcdctl endpoint status -w json | jq '.[0].Header.revision')Compact old revisions
etcdctl defrag --clusterReclaim disk on all members
etcdctl alarm disarmClear alarm after fixing cause

Kubernetes — find etcd

# Static pod on control plane (kubeadm) crictl pods | grep etcd crictl logs $(crictl ps --name etcd -q) # Or docker/containerd docker ps | grep etcd # API server etcd connection (manifest) grep etcd /etc/kubernetes/manifests/kube-apiserver.yaml

Service and ports

CheckDescription
ss -tlnp | grep 2379Client API listening
ss -tlnp | grep 2380Peer (Raft) port
systemctl status etcdStandalone etcd service

Pro tips

  • Kubernetes control plane stops when etcd loses quorum — prioritize odd-member clusters
  • Always use ETCDCTL_API=3 — v2 API is deprecated
  • NOSPACE alarm means disk full — free space, defrag, then alarm disarm
  • Never copy the data dir on a running member — use snapshot save
  • Schedule snapshots before upgrades; test restore on a non-production cluster

Practice scenarios

Hands-on etcd scenarios on live Linux VMs: etcd

SadServersSadServers

Real-world Linux and DevOps scenarios for hands-on learning and technical assessment.

Uptime Robot ratio (30 days)
Product
  • Scenarios
  • For Individuals
  • For Businesses
  • Pricing
Resources
  • FAQ
  • Blog
  • Newsletter
Company
  • About Us
  • Support
  • Privacy Policy
  • Terms of Service
  • Contact
Connect With Us
info@sadservers.com

Made in Canada 🇨🇦
Updated: 2026-06-13 16:06 UTC – 2d2950a