How to delete keys
Describes a way to delete etcd keys
Prerequisites
- Install etcd and etcdctl
Add or delete keys
del to remove the specified key or range of keys:
1. etcdctl del $KEY [$END_KEY]
Options
1. --prefix[=false]: delete keys with matching prefix
2. --prev-kv[=false]: return deleted key-value pairs
3. --from-key[=false]: delete keys that are greater than or equal to the given key using byte compare
4. --range[=false]: delete range of keys without delay
Options inherited from parent commands
1. --endpoints="127.0.0.1:2379": gRPC endpoints
Examples

1. etcdctl --endpoints=$ENDPOINTS put key myvalue
2. etcdctl --endpoints=$ENDPOINTS del key
4. etcdctl --endpoints=$ENDPOINTS put k1 value1
5. etcdctl --endpoints=$ENDPOINTS put k2 value2
6. etcdctl --endpoints=$ENDPOINTS del k --prefix
Last modified July 6, 2025: etcd-website: rearrange files in developer and operator (06dc032)
