CKA — etcd Best Practices
Backup Frequency
| Environment | Recommended Frequency |
|---|---|
| Production (critical) | Every 1-2 hours |
| Production (standard) | Every 4-6 hours |
| Staging | Daily |
| Development | Before changes |
| CKA exam | Before upgrades or destructive operations |
Automated Backups
Create a cron job for automated etcd backups:
# Example: Backup every 6 hours
0 */6 * * * ETCDCTL_API=3 etcdctl \
--endpoints=https://127.0.0.1:2379 \
--cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/server.crt \
--key=/etc/kubernetes/pki/etcd/server.key \
snapshot save /backup/etcd/snapshot-$(date +%Y%m%d-%H%M).db
etcd Performance
| Factor | Recommendation |
|---|---|
| Disk | Use SSD storage for fast write operations |
| Network | Low-latency network between etcd members |
| Memory | etcd should have dedicated memory (not shared with heavy workloads) |
| Compaction | etcd auto-compacts by default; monitor disk usage |
| Defragmentation | Run periodic defragmentation to reclaim disk space |
Check etcd Disk Usage
du -sh /var/lib/etcd/
Separate etcd for HA
In large production clusters, consider running etcd on dedicated nodes (external etcd topology):
| Topology | etcd Location | Pros | Cons |
|---|---|---|---|
| Stacked | On control plane nodes | Simpler setup, fewer machines | etcd shares resources |
| External | On dedicated nodes | Better performance, isolation | More infrastructure |
Disaster Recovery Planning
- Regular backups to offsite storage (S3, GCS)
- Test restores periodically in a staging environment
- Document the restore process for your team
- Multi-region backups for critical clusters
- Encrypt backups at rest (etcd data contains Secrets)
Exam tip: While automated backups and HA are not directly tested, understanding these concepts helps with troubleshooting questions about etcd health and data recovery.
Next: Hands-On Lab ->