Followers

ectd server

 


  • etcd is a consistent and highly-available key value store used as Kubernetes' backing store for all cluster data.
  • etcd is an open source distributed key-value store used to hold and manage the critical information that distributed systems need to keep running.
  • Kubernetes uses etcd to store all its data – its configuration data, its state, and its metadata.
  • It stores the data in key value pair

Access etcd data

Prerequisite ( Install etcdctl )

   sudo apt -y install wget
   export RELEASE="3.3.13"
   wget https://github.com/etcd-io/etcd/releases/download/v${RELEASE}/etcd-v${RELEASE}-linux-amd64.tar.gz
   tar xvf etcd-v${RELEASE}-linux-amd64.tar.gz
   cd etcd-v${RELEASE}-linux-amd64
   sudo mv etcd etcdctl /usr/local/bin
   etcd --version
   etcdctl --version

Step1:- check etcd pod description with following command

   kubectl describe pod etcd-kmaster -n kube-system

Check the command property of etcd it contains all the information of the etcd server properties

Step2:- Find all the keys in etcd server

ETCDCTL_API=3 etcdctl --endpoints=https://172.31.8.197:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --key=/etc/kubernetes/pki/etcd/server.key --cert=/etc/kubernetes/pki/etcd/server.crt get / --prefix --keys-only

Step3:- Put a key in etcd db

ETCDCTL_API=3 etcdctl --endpoints=https://172.31.8.197:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --key=/etc/kubernetes/pki/etcd/server.key --cert=/etc/kubernetes/pki/etcd/server.crt put name raman

Step4:- Get a key value from etcd server

ETCDCTL_API=3 etcdctl --endpoints=https://172.31.8.197:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --key=/etc/kubernetes/pki/etcd/server.key --cert=/etc/kubernetes/pki/etcd/server.crt get name

Backup and Restore etcd server

𝐄𝐓𝐂𝐃 𝐁𝐚𝐜𝐤𝐮𝐩 & 𝐑𝐞𝐬𝐭𝐨𝐫𝐞

We should use the ETCDCTL tool to interact with the ETCD cluster. Let’s look at the steps involved in the backup:

➥ Create a data snapshot ➥ Copy the snapshot to a PVC ➥ Restore the snapshot in a new cluster

And, that is exactly how we start creating a highly available cluster.

Backup etcd server

ETCDCTL_API=3 etcdctl snapshot save snapshot.db  --cacert=/etc/kubernetes/pki/etcd/ca.crt --key=/etc/kubernetes/pki/etcd/server.key --cert=/etc/kubernetes/pki/etcd/server.crt
Snapshot saved at snapshot.db

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

  mkdir backup
  cd backup/
  cp -r /etc/kubernetes/pki .

Restore etcd server

--Reset the cluster
 kubeadm reset -f

---Copy the folder
cd backup
cp -r pki  /etc/kubernetes
cd ..

ETCDCTL_API=3 etcdctl snapshot restore snapshot.db
mv default.etcd/member /var/lib/etcd/

COMMENTS

Name

Ansible,6,AWS,1,Azure DevOps,1,Containerization with docker,2,DevOps,2,Docker Quiz,1,Docker Swarm,1,DockerCompose,1,ELK,2,git,2,Jira,1,Kubernetes,1,Kubernetes Quiz,5,SAST DAST Security Testing,1,SonarQube,3,Splunk,2,vagrant kubernetes,1,YAML Basics,1,
ltr
static_page
DevOpsWorld: ectd server
ectd server
DevOpsWorld
https://www.devopsworld.co.in/p/ectd-server.html
https://www.devopsworld.co.in/
https://www.devopsworld.co.in/
https://www.devopsworld.co.in/p/ectd-server.html
true
5997357714110665304
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content