LinuxCommandLibrary

etcdctl

TLDR

Set a key

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

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.

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), zookeeper(1)

Copied to clipboard