🗄️
Container Platform

etcd

Distributed key-value store — Kubernetes uses it for cluster state

🐧 Linux🍎 Mac🪟 Windows
Reviewed: Tested on: Kubernetes 1.29 · Terraform 1.8 · Ubuntu 22.04

What is this?

etcd is a distributed key-value store — Kubernetes stores all cluster state in etcd.

📥

Step 01

Install etcd

(01)Install etcd

Linux
1# Single-node dev cluster
2ETCD_VER=v3.5.15
3curl -L https://github.com/etcd-io/etcd/releases/download/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o etcd.tar.gz
4tar xzf etcd.tar.gz && sudo mv etcd-${ETCD_VER}-linux-amd64/etcd* /usr/local/bin/
⚙️

Step 02

Configure etcd

(01)Configure etcd

Linux
1etcd --name dev --data-dir /tmp/etcd-data \
2 --listen-client-urls http://127.0.0.1:2379 \
3 --advertise-client-urls http://127.0.0.1:2379
4
5# Another terminal:
6etcdctl put mykey "hello"
7etcdctl get mykey

Step 03

Verify

(01)Verify installation

Linux
1etcdctl endpoint health
2etcdctl member list
🔧

Step 04

Common Problems

#1etcd cluster unhealthy / connection refused

Linux
1etcdctl endpoint health --endpoints=http://127.0.0.1:2379
2sudo ss -tlnp | grep 2379
3# Check data dir permissions
4ls -la /tmp/etcd-data