Etcd In Kubernetes
- ETCD data store has the following:
- Nodes
- PODs
- Configs
- Secrets
- Accounts
- Roles
- Bindings
- Other
- Every piece of information you see when you run the
kubectl getcommand is from the ETCD server. - Every additional change you make to your cluster - adding nodes, deploying pods or replica sets are updated in the ETCD server.
- Only once the updates are updated in the ETCD server, is the change considered to be complete.
- The practice test environments are deployed using the
kubeadmtool. Later in the course when a cluster is set up, it is set up from scratch.- If you set up your cluster from scratch, you deploy ETCD by downloading the binaries yourself. This also includes configuring
ETCDas a service on your Master Node.
- If you set up your cluster from scratch, you deploy ETCD by downloading the binaries yourself. This also includes configuring
- You can pass many options such as certificates and these will be looked into further in the course.
- There is a whole section of TLS certificates.
- You can also configure
ETCDas a cluster - part of high availability in Kubernetes. - The one option to note for now from the above screenshot is the
--advertise-client-urls https://${INTERNAL_IP}:2379 \\.- This is the address where
ETCDlistens. This is on the IP of the server and is on port2379. That is the default port whichETCDlistens on.- This should be configured on the
kube-apiserver, when it tries to reach theETCDserver.
- This should be configured on the
- This is the address where
- If you cluster is using
kubeadm,kubeadmwill then deploy the ETCD server for you as a pod.- This will be in the
kube-systemnamespace.
- This will be in the
- You can explore the ETCD database, by using the etcd control utility within the
etcd-masterpod. - To list all keys stored by Kubernetes, run the
etcdcontrol get command.kubectl exec etcd-master -n kube-system etcdctl get / --prefix -keys-only - The output looks like the below:

- Kubernetes stores data in a specific directory structure.
- The
rootdirectory is the registry and under that you have various Kubernetes constructs.
- ETCD in a High Availability Environment
- You have multiple Master Nodes in the cluster. There are multiple ETCD nodes spread across the Master Nodes.
- Make sure the
etcdinstances know about each other. Set the right parameters in theetcd service configurationunderetcd.service.
- The
initial-clusteroption is where you specify the different instances of theetcdservice.