K8s 内存泄漏 runc、kubelet 编译方法
发表于|更新于
|字数总计:512|阅读时长:2分钟
K8s 内存泄漏 runc、kubelet 编译方法
准备一台和生产节点相同内核版本的机器
yum install golang git -y
yum -y install gcc gcc-c++ kernel-devel libseccomp-devel
|
runc 编译
有两种方法下载runc的代码
cd $GOPATH/src/github.com/opencontainers git clone https://github.com/opencontainers/runc
cd runc git checkout v1.0.0-rc9
make BUILDTAGS='seccomp nokmem'
|
kubelet 编译
cd $GOPATH/src/github.com/opencontainers git clone https://github.com/kubernetes/kubernetes cd kubernetes/
git checkout v1.20.9
GO111MODULE=on KUBE_GIT_TREE_STATE=clean KUBE_GIT_VERSION=v1.20.9 make kubelet GOFLAGS="-tags=nokmem"
|
替换 runc、kubelet
mv /usr/bin/kubelet /home/kubelet mv /usr/bin/runc /home/runc
systemctl stop docker systemctl stop kubelet
cp /root/k8s/kubernetes/_output/bin/kubelet /usr/bin/kubelet cp /root/k8s/kubernetes/_output/bin/kubelet /usr/local/bin/kubelet cp /data/Documents/src/github.com/opencontainers/runc/runc /usr/bin/runc
|
检查验证
检查kmem是否关闭前需要将此节点的pod杀掉重启或者重启服务器,当结果为0时成功
reboot
cat /sys/fs/cgroup/memory/kubepods/burstable/memory.kmem.usage_in_bytes cat /sys/fs/cgroup/memory/kubepods/memory.kmem.slabinfo
|
参考