Backup
Task 4: Backup and Restore etcd in Kubernetes
etcd in KubernetesStep 1: Access the etcd Pod
etcd Podkubectl get pods -n kube-system -l component=etcdIssue
Cause
Solution
Step 2: Find the etcdctl Command Path
etcdctl Command PathETCDCTL=$(kubectl get pods -n kube-system -l component=etcd -o jsonpath="{.items[0].spec.containers[0].command}" | grep -o '/.*etcdctl')
echo $ETCDCTLapt update && apt install etcd-client -y # Debian/Ubuntu
yum install etcd -y # CentOS/RHELIssue
Cause
Solution
Step 3: Take an etcd Snapshot
etcd SnapshotMethod 1: Run in the etcd Pod (Recommended)
etcd Pod (Recommended)Issue
Cause
Solution
Step 4: Move Snapshot to a Safe Location
Issue
Cause
Solution
Step 5: Restore etcd from Backup
etcd from BackupStep 5.1: Stop Control Plane Services (Only for Self-Managed Clusters)
Issue
Cause
Solution
Step 5.2: Restore Snapshot
Issue
Cause
Solution
Step 5.3: Replace Old etcd Data
etcd DataStep 5.4: Restart etcd and Control Plane
etcd and Control PlaneIssue
Cause
Solution
Step 6: Verify Cluster Health After Restore
Summary
Next Task: Do you want to proceed with Kubernetes High Availability setup or Disaster Recovery automation? 😊
Last updated