kube-etcd 容量 大于 2G 导致 etcd数据库 起不来
使用 swr.cn-east-2.myhuaweicloud.com/kuboard/etcd-host:3.4.16-2 版本的etcd 数据库 由于没有设置 ,容量参数,导致 数据大于2G就无法启动。
报错截图:
etcdserver/api/etcdhttp: /health error due to memberID: alarm:NOSPACE
解决参数: --quota-backend-bytes=8589934592#调大到8GB
需要官方在制作镜像进行添加参数
临时办法
1、修改 kube-etcd 监控检测,时间调大点,防止重启
kubectl edit daemonsets.apps -n kuboard kuboard-etcd
2、执行 下方命令 (不建议使用 127.0.0.1 使用 master 的网卡IP地址)
ETCDCTL_API=3 ./etcdctl --endpoints="http://192.168.102.30:2381" --write-out=table endpoint status
ETCDCTL_API=3 ./etcdctl --endpoints="http://192.168.102.30:2381" compact $(ETCDCTL_API=3 ./etcdctl --endpoints="http://192.168.102.30:2381" endpoint status --write-out="json" | egrep -o '"revision":[0-9]*' | egrep -o '[0-9].*')
ETCDCTL_API=3 ./etcdctl --endpoints="http://192.168.102.30:2381" defrag
ETCDCTL_API=3 ./etcdctl --endpoints="http://192.168.102.30:2381" alarm disarm
恢复正常
不需要去改镜像,改启动命令就可以了 加上开启自动压缩
kubectl patch DaemonSet
kuboard-etcd
--namespace kuboard
--type='json'
-p='[{"op": "replace", "path": "/spec/template/spec/containers/0/args", "value": [
"/usr/local/bin/etcd",
"--auto-compaction-retention=1",
"--quota-backend-bytes=8388608000"
]}]'
这里修改了entrypoint 里面的 etcd 启动参数 添加--quota-backend-bytes=8589934592 , 启动了好像还是生效不了
containers:
- name: etcd
image: swr.cn-east-2.myhuaweicloud.com/kuboard/etcd-host:3.4.16-2
imagePullPolicy: Always
command:
- etcd args:
- --name=$(HOSTNAME)
- --listen-peer-urls=http://$(HOSTIP):2382
- --listen-client-urls=http://$(HOSTIP):2381
- --advertise-client-urls=http://$(HOSTIP):2381
- --initial-advertise-peer-urls=http://$(HOSTIP):2382
- --initial-cluster-token=kuboard-etcd-cluster-1
- --initial-cluster=$(PEERS)
- --initial-cluster-state=new
- --snapshot-count=10000
- --log-level=info
- --logger=zap
- --data-dir=/data
- --quota-backend-bytes=8589934592
- --auto-compaction-mode=periodic
- --auto-compaction-retention=1 我是直接修改了 启动命令