- Distributed key-value store that stores the cluster state. ETCD is distributed datastore, which means it replicates the data across all its instances. That way, if one of them crashes, the data is still available on the rest of them.
- When setting up the cluster from scratch, the
etcd
binary needs to be downloaded and run as a service on the master node. By default it listens on port2379
.
- When setting up the cluster using KubeAdmin,
etcd
is automatically deployed as a static pod on the master node.
etcdctl
utility can be used to interact withetcd
to get and put items in it.
- In a cluster with multiple master nodes (for high availability), the
etcd
service will be running on each master node and will be communicating with each other on port2380
. This can be configured in theetcd
config.
etcdctl
Installation
Follow the release notes for any
etcd
release to download and unzip the etcd
and etcdctl
binary from . At the end, move the extracted binaries to /usr/local/bin
or /usr/bin
.Commands
- Backup a cluster’s ETCD
ETCDCTL_API=3 etcdctl \ --cacert=/etc/kubernetes/pki/etcd/ca.crt \ --cert=/etc/kubernetes/pki/etcd/server.crt \ --key=/etc/kubernetes/pki/etcd/server.key \ snapshot save <backup-filename>
- Restore a cluster from an ETCD backup
ETCDCTL_API=3 etcdctl snapshot restore --data-dir="/var/lib/etcd-snapshot" <backup-filename>