Rancher 2.1.4 集群安装后用着用着就发现主机的内存占用非常高,占用的进程是Etcd。
经查验证,这算是个bug吧。https://github.com/rancher/rancher/issues/14322
kubectl get templatecontents | wc -l
得到的值很大。
升级到2.2.3后,templatecontents清理了,但内存还是没降下来
参考https://rancher.com/docs/rancher/v2.x/en/troubleshooting/kubernetes-components/
docker exec etcd etcdctl endpoint status \
--endpoints=$(docker exec etcd /bin/sh -c \
"etcdctl member list | cut -d, -f5 | sed -e 's/ //g' | paste -sd ','") --write-out table
rev=$(docker exec etcd etcdctl endpoint status \
--write-out json | egrep -o '"revision":[0-9]*' | egrep -o '[0-9]*')
docker exec etcd etcdctl compact "$rev"
docker exec etcd etcdctl defrag \
--endpoints=$(docker exec etcd /bin/sh -c \
"etcdctl member list | cut -d, -f5 | sed -e 's/ //g' | paste -sd ','")
docker exec etcd etcdctl endpoint status \
--endpoints=$(docker exec etcd /bin/sh -c \
"etcdctl member list | cut -d, -f5 | sed -e 's/ //g' | paste -sd ','") --write-out table