kubernetes tutorial | ETCD Backup and Restore using "etcdctl" tool | Demo

Published: 30 November 2023
on channel: VSPARKZ
1,055
17

CERTIFIED KUBERNETES ADMINISTRATOR
-------------------------------------------------------------------------


kubernetes tutorial | ETCD Backup and Restore using "etcdctl" tool | Demo
--------------------------------------------------------------------------------------------------------------------------

In this video, you are going to see a DEMO on "ETCD Backup and Restore"



For suggestions/feedback/doubts contact
email: [email protected]


Happy Learning !!!


===========================================================================================

USEFUL LINKS
----------------------------


Operating ETCD Clusters


https://kubernetes.io/docs/tasks/admi...




Backup and Restore ETCD


https://kubernetes.io/docs/tasks/admi...




Install ETCD binaries


https://etcd.io/docs/v3.5/install/


https://github.com/etcd-io/etcd/relea...




Kubectl Command Reference


https://kubernetes.io/docs/reference/...




==========================================================================================
#cka #kubernetes #k8s #containers #vsparkz




DEMO STEPS

****************


Step 1 - Connect to the k8S Cluster and Check ETCD Version
-----------------------------------------------------------------------------------------------------


$ kubectl cluster-info


$ kubectl get nodes


$ kubectl get pods -n kube-system


$ kubectl describe pods pod_name -n kube-system




Step 2 - Download and Install “etcdctl” Tool
---------------------------------------------------------------------------


Reference: https://etcd.io/docs/v3.5/install/




$ curl -L https://storage.googleapis.com/etcd/v... -o /tmp/etcd-v3.5.10-linux-amd64.tar.gz


$ tar xzvf /tmp/etcd-v3.5.10-linux-amd64.tar.gz -C /tmp


$ cp /tmp/etcd-v3.5.10-linux-amd64/etcdctl /usr/local/bin/




Step 3 - Take a Backup from ETCD database using “etcdctl” Tool
------------------------------------------------------------------------------------------------------------


Reference: https://kubernetes.io/docs/tasks/admi...




$ ETCDCTL_API=3 etcdctl snapshot save /root/snapshot.db --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




$ ETCDCTL_API=3 etcdctl --write-out=table snapshot status /root/snapshot.db






Step 4 - Delete the deployments/pods in the cluster
------------------------------------------------------------------------------------------


$ kubectl delete deployment deployment_name




Step 5 - Create a New ETCD volume directory and restore the Snapshot

----------------------------------------------------------------------------------------------------------------------


$ mkdir /var/lib/etcd-bkp


$ ETCDCTL_API=3 etcdctl snapshot restore /root/snapshot.db --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 --data-dir=/var/lib/etcd-bkp





Step 6 - Update the ETCD static pod definition to use the New ETCD Volume
--------------------------------------------------------------------------------------------------------------------


$ vim /etc/kubernetes/manifest/etcd.yaml




Step 7 - Inspect the cluster after the ETCD backup restoration
----------------------------------------------------------------------------------------------------------


$ kubectl get all




THE END


Watch video kubernetes tutorial | ETCD Backup and Restore using "etcdctl" tool | Demo online without registration, duration hours minute second in high quality. This video was added by user VSPARKZ 30 November 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,055 once and liked it 17 people.