How to delete keys

Describes a way to delete etcd keys


Add or delete keys

del to remove the specified key or range of keys:

etcdctl del $KEY [$END_KEY]


--prefix[=false]: delete keys with matching prefix
--prev-kv[=false]: return deleted key-value pairs
--from-key[=false]: delete keys that are greater than or equal to the given key using byte compare
--range[=false]: delete range of keys without delay

Options inherited from parent commands

--endpoints="": gRPC endpoints



etcdctl --endpoints=$ENDPOINTS put key myvalue
etcdctl --endpoints=$ENDPOINTS del key

etcdctl --endpoints=$ENDPOINTS put k1 value1
etcdctl --endpoints=$ENDPOINTS put k2 value2
etcdctl --endpoints=$ENDPOINTS del k --prefix

Last modified March 19, 2024: Update how-to-delete-keys doc. (704e186)