Gennway:
and to create/restore backup I used
1.
ETCDCTL_API=3 etcdctl --endpoints=<https://172.17.0.28:2379> --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key snapshot save /opt/etcd-backup.db
2.
ETCDCTL_API=3 etcdctl --endpoints=<https://172.17.0.28:2379> --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key snapshot restore /opt/etcd-backup.db --data-dir=/var/lib/etcd-backup
3.
I changed in the /etc/kubernetes/etcd.yml
volumes:
- hostPath:
path: /var/lib/etcd
type: DirectoryOrCreate
name: etcd-data
into
volumes:
- hostPath:
path: /var/lib/etcd-backup
type: DirectoryOrCreate
name: etcd-data
and it doesnt work :circlethinking:
Basavraj Nilkanthe:
@Gennway try with etcd restart
Basavraj Nilkanthe:
There might be stale issue
Basavraj Nilkanthe:
And you don’t need to pass certs details while restoring it.
Basavraj Nilkanthe:
If it doesn’t work even after etcd restart. Try to restart kube-scheduler and kube-controlplane as these two component related with etcd
Gennway:
I tried again, and it still doesnt work lol
Gennway:
anyway I still dont know why the original etcd is mounted to /var/lib/etcd even if this directory doesnt exist
Gennway:
@Mumshad Mannambeth
Gennway:
i have no idea, i made again lab with creating etcd backup and restoring it and it worked, now i wanted to try the same thing in mock exam and it doesnt work
Basavraj Nilkanthe:
There must be bug
Mumshad Mannambeth:
HI @Gennway can you share more details on what you mean by not work? Is the pod up? Are there any errors? What’s the status? Did you give it enough time for it to come back etc.
Gennway:
let me sec, I’ll try to recreate that
Gennway:
anyway I still dont knot why directory /var/lib/etcd doesnt exist on controlplane (etcd by default is plugged into that directory)
Gennway:
so once again its mock exam 2, task 1.
I make backup with that command ETCDCTL_API=3 etcdctl --endpoints=<https://172.17.0.10:2379> --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key snapshot save /opt/etcd-backup.db which is fine
Gennway:
then I restore with ETCDCTL_API=3 etcdctl --endpoints=<https://172.17.0.10:2379> snapshot restore /opt/etcd-backup.db --data-dir=/var/lib/etcd-backup
Gennway:
then I change in /etc/kubernetes/manifest/etcd.yml
volume path to
- hostPath:
path: /var/lib/etcd-backup
type: DirectoryOrCreate
name: etcd-data
Gennway:
controlplane $ k get pods -A
No resources found
Gennway:
also, as I mentioned earlier, I cant see the original directory of etcd in this lab which is /var/lib/etcd, I have no idea what’s happening
@Mumshad Mannambeth