1、etcdctl常用操作
etcdctl官方文档链接:https://github.com/etcd-io/etcd/tree/main/etcdctl
为了简化操作,需先声明与证书相关的环境变量,登录其中一台控制节点操作即可:
export ETCDCTL_CACERT=/etc/ssl/etcd/ssl/ca.pem
export ETCDCTL_CERT=/etc/ssl/etcd/ssl/admin-controller-xx.pem
export ETCDCTL_KEY=/etc/ssl/etcd/ssl/admin-controller-xx-key.pem
获取指定的key的值
etcdctl get /registry/configmaps/default/application-progress
仅获取key(模糊匹配)
etcdctl get --prefix '/registry/leases/' --keys-only
仅获取所有的key
etcdctl get --from-key '' --keys-only
2、etcd数据备份与恢复
从快照恢复数据
etcdctl snapshot restore /tmp/db \
--data-dir=/var/lib/etcd \
--name etcd1 \
--initial-cluster etcd1=http://1.1.1.1:2380 \
--initial-cluster-token k8s_etcd \
--initial-advertise-peer-urls http://1.1.1.1:2380 \
--skip-hash-check=true
标签:etcd,--,etcdctl,ssl,key,1.1
From: https://www.cnblogs.com/zgjj/p/16746996.html