如何根据容器中的PID量终止POD?
设置:多服务器K8S群集
我想终止容器/POD时,当来自特定用户中的容器中运行的PID数量低于一定计数。例如:如果“用户”在容器中运行的PID少于15个,则我希望容器和POD终止,以便旋转新副本。理想情况下,我将在群集中运行一个cronjob,该群集查询用户运行的PID数量,如果低于15的PID终止POD。我不知道该如何查询从外部的容器内奔跑的PID。有什么想法可能有效吗?
Setup: Multi-server K8s cluster
I want to terminate a container/pod when the number of PIDs running in the container from a specific user is below a certain count. For example: If "user" has less than 15 PIDs running in the container, I want the container and pod to terminate so that it spins up a new copy. Ideally I would have a cronjob run in the cluster that queries the number of PIDs that user has running, and if it is below 15, terminate the pod. I don't know how to query the PIDs running inside a container from the outside. Any ideas that might work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的意思是您需要重新启动POD吗?
您可以使用此处描述的LivicesProbe尝试: https://kubernetes.io/docs/tasks/configure-pod-container/configure-lives-lives-lices-lices-startup-probes/
示例:
您可以在命令中实现逻辑以计算进程
Did you mean you need a pod restart?
You can try this with livenessProbe as described here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
Example:
You can implement your logic in command for counting processes