1. 使用crictl 查看容器ID
powershell
crictl ps
2. 查看Cgroup位置
powershell
crictl inspect 容器ID
3. 到容器Cgroup的目录下
使用上个命令就能找到CgroupPath
4 . 到cgroup目录下
正确目录是 :
/sys/fs/cgroup/memory/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-podf68e1877_4a10_423e_a0f4_9ac64be78637.slice/cri-containerd-b639921a4406145ca0c7adea96b231e533cb8d17f02182758d8fc4b8ef9b24df.scope
其中: /sys/fs/cgroup/memory/kubepods.slice/kubepods-burstable.slice/ 是固定的然后根据上个命令查看的位置移动到该目录
修改值
使用echo 将值放入上个地址目录中的
powershell
echo 1073741824 > /sys/fs/cgroup/memory/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-podf68e1877_4a10_423e_a0f4_9ac64be78637.slice/cri-containerd-b639921a4406145ca0c7adea96b231e533cb8d17f02182758d8fc4b8ef9b24df.scope/memory.limit_in_bytes