etcdctl

command-line client for etcd key-value store

TLDR

Set a key
$ etcdctl put [mykey] "[myvalue]"
Get a key
$ etcdctl get [mykey]
Get all keys with prefix
$ etcdctl get --prefix [/myapp/]
Delete a key
$ etcdctl del [mykey]
Watch for changes
$ etcdctl watch [mykey]
List cluster members
$ etcdctl member list
Check cluster health
$ etcdctl endpoint health

SYNOPSIS

etcdctl [global-options] command [args]

DESCRIPTION

etcdctl is the command-line client for etcd, a distributed key-value store used for shared configuration and service discovery. It's a core component of Kubernetes for storing cluster state.etcd provides strong consistency through the Raft consensus algorithm. etcdctl manages keys, watches for changes, and administers the cluster.

PARAMETERS

put key value

Set key to value.
get key
Get key value.
del key
Delete key.
watch key
Watch key for changes.
--prefix
Apply operation to keys with prefix.
member list
List cluster members.
member add name urls
Add cluster member.
member remove id
Remove cluster member.
endpoint health
Check endpoint health.
snapshot save file
Save cluster snapshot.
snapshot restore file
Restore from snapshot.
--endpoints urls
etcd endpoints.
--cacert file
CA certificate.
--cert file
Client certificate.
--key file
Client key.

INSTALL

sudo apt install etcd-client
sudo apk add etcd-ctl
sudo zypper install etcdctl

CAVEATS

API version 3 is default (set ETCDCTL_API=3). Authentication may be required. Cluster operations need careful planning. Snapshots should be taken regularly. Large values impact performance.

HISTORY

etcd was created by CoreOS in 2013 as a distributed configuration store for their Container Linux. It became a CNCF project and is now maintained by the etcd community. Kubernetes adopted etcd as its backing store from the beginning.

SEE ALSO

kubectl(1), consul(1)