Kubernetes Docker操作系统参数与主机操作系统参数

时间:2017-04-04 17:26:31

标签: linux docker kubernetes

我在Docker容器上运行NGINX和Tomcat(容器操作系统是Red Hat linux)并通过Kubernetes pod进行部署。主机操作系统是Red Hat Linux。

我的查询是哪个OS参数有效 - 主机操作系统或容器操作系统?在性能调优期间,我需要调整OS或主机OS参数是否有效。 我所指的一些参数示例是ulimit -n(打开文件),net.ipv4.tcp。*,fs.file-max等。

3 个答案:

答案 0 :(得分:2)

As Crazykev already mentioned, you can set ulimits using the respective docker run flags.

Parameters like net.ipv4.tcp.* are kernel parameters. Docker containers are run in the same Linux kernel as the host system; for this reason, parameters set on the host will also be effective in the container.

Usually, you will not be able to set these parameters from inside a container. You can (not saying you should) start a container with the --privileged flag, which might (untested) give you access to setting kernel parameters from within the container. The Kubernetes docs also describe how to start privileged containers.

答案 1 :(得分:1)

In Docker container, and I'm not sure if it could be called as OS...

By the way, some of your referring example may not support set directly in docker container for safety or other issues. You may need to find more manual in docker docs.(for example, ulimit, docker run --ulimit nofile=262144:262144)

答案 2 :(得分:0)

Kubernetes现在不支持添加ulimit kubernetes中有一个issue

有关设置ulimit的类似问题已被回答here