简体   繁体   English

如果容器不与主机共享内核,解析 cgroup 文件是否可行?

[英]Is parsing cgroup files for stats viable if the container is not sharing the kernel with host?

Stats found in cgroup files on the host, are they reliable if the container does not share the kernel with the host?在主机上的 cgroup 文件中找到的统计信息,如果容器不与主机共享内核,它们是否可靠?

I'm asking this because while it was reliable with docker, with multiple runtimes being supported by K8s - some that offer containers with their own kernels, should I rely on the runtime daemons for stats or can I bypass them and still look at cgroup files.我问这个是因为虽然它对 docker 来说是可靠的,但 K8s 支持多个运行时 - 有些提供带有自己内核的容器,我应该依赖运行时守护进程来获取统计信息还是我可以绕过它们并仍然查看 cgroup 文件.

If you are referring to Kata Containers with Docker and Kubernetes the short answer is yes.如果您指的是带有 Docker 和 Kubernetes 的 Kata Containers,那么简短的回答是肯定的。 Make sure you configure sandbox_cgroup_only=true to get the accurate stats.确保配置sandbox_cgroup_only=true以获取准确的统计信息。

Also, make sure you use Kata Containers 1.11.0 or later as the cgroups implementation fix went into that version.此外,请确保您使用 Kata Containers 1.11.0或更高版本,因为cgroups 实现修复进入该版本。 Kata Containers creates its own cgroups in the Kernel running in the VM but that matches what's created at the host level. Kata Containers 在 VM 中运行的内核中创建自己的 cgroup,但这与在主机级别创建的内容相匹配。 The resources for these cgroups created at the host level are not used, but rather the resources allocated by the VMM.在主机级别创建的这些 cgroup 的资源没有被使用,而是由 VMM 分配的资源。 Some more info here .这里有更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 kubelet 无法获取 docker 和 kubelet 服务的 cgroup 统计信息 - kubelet fails to get cgroup stats for docker and kubelet services 从 Windows 主机到 Kubernetes 容器的共享目录(使用 Docker 桌面) - Sharing directory from Windows host to Kubernetes container (using Docker Desktop) kubernetes pod 中的容器是否属于同一 cgroup? - Are the container in a kubernetes pod part of same cgroup? 在容器内将文件从容器复制到主机 - Copy files from container to host while inside the container Kubelet 无法获取“/system.slice/docker.service”的 cgroup 统计信息 - Kubelet failed to get cgroup stats for “/system.slice/docker.service” Kubernetes:如何将容器日志文件挂载到主机 - Kubernetes: how can I mount container log files to host 当主机上的文件更改时,Minikube挂载不会通知容器 - Minikube mount doesn't notify container when files change on the host 我可以在没有 bash 脚本的情况下使用 docker-compose 来检查容器,然后将文件从容器复制到主机吗? - Can I use docker-compose without a bash script to inspect a container then copy files to host from the container? 很多 kubelet 错误:无法更新容器的统计信息 - A lot of kubelet errors : Failed to update stats for container 内存使用率差异:cgroup memory.usage_in_bytes与docker容器内的RSS - Memory usage discrepancy: cgroup memory.usage_in_bytes vs. RSS inside docker container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM