在 kubernetes 上为 kubelet 启用 PodSharingNamespace / Perf 设置
我正在浏览一个教程,上面写着
确保您使用的是 Kubernetes 1.10+ 并且启用了以下设置: 为 apiserver 和 kubelet 开启功能门 PodShareProcessNamespace=true
我已在线搜索,但无法找到任何方法来打开 kubelet 的功能门。一些网站建议编辑 /etc/kuberenetes/kubelet.env 但我的集群上似乎没有该文件。
那么为 kubelet 启用功能门的正确方法是什么?
编辑:(根据评论添加更多详细信息)
我的目标是通过 sidecar 注入在集群上运行 perf。同样,我需要启用 kubelet 和 kube-apiserver feature-gate“PodShareProcessNamespace=true”。 这个
> 是我在 digitalocean 非托管 3 个工作人员 - 1 个主集群上工作
。我以前从未在 minikube 之外使用过 kuberenetes,所以我可能会问一个非常愚蠢或明显的问题。此外,我不太清楚 feature-gate
到底是什么,所以这可能是我的问题没有多大意义的原因
I was going through a tutorial that said
Ensure you are using Kubernetes 1.10+ and the following settings are enabled:
Feature-gate PodShareProcessNamespace=true is turned on for both apiserver and kubelet
I have searched online but am unable to find any way to turn on feature-gates for a kubelet. Some sites have suggested editing /etc/kuberenetes/kubelet.env but I don't seem to have that file on my cluster.
So what is the right way to enable feature gates for a kubelet?
Edit: (Adding more details as per comment)
My goal is to run perf on a cluster through sidecar injection. For the same I need to enable kubelet and kube-apiserver feature-gate "PodShareProcessNamespace=true". This is the tutorial I tried following
I am working on a digitalocean unmanaged 3 worker - 1 master cluster.
I have never used kuberenetes outside minikube before and so I may be asking a very dumb or obvious question. In addition I am not very clear on what exactly a feature-gate
is so that may be the reason my question isn't making much sense
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在其他地方找到了答案,但我将其发布在这里,以便其他有类似问题的人可能会发现它有帮助。
除非您想在正在运行的集群中启用功能门而不重新启动,否则不需要所有这些复杂的操作。您只需编辑 yaml 文件并重新部署 pod 即可。
在要使用 perf 进行分析的 pod 的 yaml 文件中,您需要在
container
部分下添加ShareProcessNamespace: true
。对于像 perf 这样需要特权系统调用的 pod,您还需要设置privileged: true
。这是一个用于分析 pod 的示例 yaml,请注意,我使用的 perf 存储库只是一个安装了 perf 的简单 pod,其中有一个运行无限睡眠循环的 python 脚本,只是为了防止它被终止。要进行分析,您可以
或者
I have found the answer somewhere else but I will post it here so that other people with similar question may find it helpful.
Unless you want to enable feature-gates in a running cluster without restarting there was no need for all those complicated gymnastics. You simply need to edit the yaml file and redeploy the pod.
In the yaml file for the pod you want to profile with perf you need to add
ShareProcessNamespace: true
under thecontainer
section. For pods like perf which need privileged system calls you also need to setprivileged: true
. This is an example yaml for profiling a podnote that the perf repo I used is just a simple pod with perf installed on it which has a python script with infinite sleep loop running just to prevent it from being terminated. to profile you could either
OR