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/

    1. docker exec etcd etcdctl endpoint status \
    2. --endpoints=$(docker exec etcd /bin/sh -c \
    3. "etcdctl member list | cut -d, -f5 | sed -e 's/ //g' | paste -sd ','") --write-out table
    4. rev=$(docker exec etcd etcdctl endpoint status \
    5. --write-out json | egrep -o '"revision":[0-9]*' | egrep -o '[0-9]*')
    6. docker exec etcd etcdctl compact "$rev"
    7. docker exec etcd etcdctl defrag \
    8. --endpoints=$(docker exec etcd /bin/sh -c \
    9. "etcdctl member list | cut -d, -f5 | sed -e 's/ //g' | paste -sd ','")
    10. docker exec etcd etcdctl endpoint status \
    11. --endpoints=$(docker exec etcd /bin/sh -c \
    12. "etcdctl member list | cut -d, -f5 | sed -e 's/ //g' | paste -sd ','") --write-out table

    image.png