DEV Community

Cheedge Lee
Cheedge Lee

Posted on • Edited on • Originally published at notes-renovation.hashnode.dev

Etcd Backup and Restore (4)

Why Update etcd.yaml?

In previous posts, we see we need to update the etcd.yaml file to make the restore work. And the reason for this step is related to kubelet working mechanism.

Pod Reconciliation by kubelet:

The etcd static pod is managed by the kubelet, which uses the etcd.yaml manifest. If the manifest doesn't match the new data directory, the pod will continue using the old path, leading to a mismatch and potentially starting with stale or incorrect data.
(For more workflow details, you can check my previous post.)

Based on above, when we restored etcd to a different directory, we must update the hostPath in the manifest to match the new --data-dir path.


How to Update the Manifest

  • Locate the Manifest:
vi /etc/kubernetes/manifests/etcd.yaml
Enter fullscreen mode Exit fullscreen mode
  • Update the hostPath: For example, if you restored etcd to /root/default.etcd:
- hostPath:
    path: /root/default.etcd
    type: DirectoryOrCreate
  name: etcd-data
Enter fullscreen mode Exit fullscreen mode

Verification

After updating the manifest:

  • Check the etcd pod status:
k get pods -n kube-system
Enter fullscreen mode Exit fullscreen mode
  • Confirm the etcd logs for successful startup:
k logs etcd-controlplane -n kube-system
Enter fullscreen mode Exit fullscreen mode
  • Validate the etcd health:
ETCDCTL_API=3 etcdctl endpoint health \
     --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
Enter fullscreen mode Exit fullscreen mode

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay