简体   繁体   English

Kubernetes“不错”一个pod的CPU使用率

[英]Kubernetes “nice” a pod's CPU usage

I have a cluster w/ 3 nodes. 我有3个节点的群集。 Hurray! 欢呼! The cluster doesn't autoscale nodes. 群集不会自动扩展节点。

These nodes run an amazing web app, yet most of the time do almost nothing. 这些节点运行着出色的Web应用程序,但是大多数时候几乎什么都不做。

I also have a background process that could use an infinite amount of CPU (the usefulness drops rapidly but remains useful). 我还有一个后台进程,可以使用无限数量的CPU(有用性迅速下降但仍然有用)。

I want these background pods to run on each Node and slowed down to leave a 20% CPU headroom on the Node. 我希望这些背景Pod在每个Node上运行并放慢速度,以在Node上保留20%的CPU余量。 Or similar. 或类似。

That's the shape of a DaemonSet. 这就是DaemonSet的形状。

  • Can I tell Kubernetes to deprioritize the DaemonSet Pods w/ a 20% headroom? 我可以告诉Kubernetes取消DaemonSet Pods的优先级,使其具有20%的净空吗?

  • Can the DaemonSet Pods detect the Nodes CPU usage and deprioritize themselves (risky if buggy)? DaemonSet Pod可以检测节点的CPU使用率并对其进行优先级设置(如果有故障,则有风险)吗?

QoS looks like it's for scheduling and evicting pods to make room for other pods, but they don't get 'niced'. QoS看起来像是用于调度和驱逐Pod,以便为其他Pod腾出空间,但是它们不会“被隔离”。

Priority also looks like it's for eviction. 优先级也看起来像是驱逐。

You may achieve what you're looking for in many ways. 您可以通过多种方式实现所需的功能。

I imagine that you've already read this and that , based on the theory of this other . 我想,你已经读过这个那个 ,基于理论这个其他

Also RedHat has nice documentation about setting hardware limits via softwarre. 此外,RedHat还提供了有关通过softwarre设置硬件限制的出色文档。

Here you can find how to restrict cpu usage, which may be set inside a container to achieve what you're looking for. 在这里,您可以找到如何限制cpu的使用情况,可以在容器内设置cpu的使用量,以实现所需的功能。

So, to recap: with K8S you can set requests and limits, and inside the container you can set even further restrictive limits. 因此,回顾一下:使用K8S,您可以设置请求和限制,而在容器内,您可以设置进一步的限制。

Hope this gives you the solution or at least the path to follow in order to achieve what you want. 希望这可以为您提供解决方案,或者至少为您实现所需的路径。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM