简体   繁体   English

kube-api 服务器高 cpu

[英]kube-api server high cpu

I want to know how I can check why one of my ctrl node and kube.netes consumes more cpu than the others.我想知道如何检查为什么我的 ctrl 节点和 kube.netes 中的一个比其他节点消耗更多的 cpu。

I have a cluster with 3 ctrl nodes and 4 worker nodes.我有一个包含 3 个控制节点和 4 个工作节点的集群。

I have an nginx load balancer with the least_conn algorithm to distribute the requests to the ctrl nodes.我有一个 nginx 负载均衡器,它使用 least_conn 算法将请求分发到 ctrl 节点。

Monitoring the resources with the top command, I observe that of the three ctrl nodes, the kube api server process always in the first ctrl node gives me a cpu usage above 100%, unlike the other ctrl nodes where the kube-api server uses less than 20%.使用 top 命令监视资源,我观察到在三个 ctrl 节点中,kube api 服务器进程始终在第一个 ctrl 节点中,使我的 cpu 使用率超过 100%,这与 kube-api 服务器使用较少的其他 ctrl 节点不同超过 20%。

I want to know why?我想知道为什么?

And how can I see that same representation of consumption, be it pod, containers.我如何才能看到相同的消费表示,无论是 pod 还是容器。 nodes in grafana grafana中的节点

After finding what happens in your cluster using kubctl top node and kubectl top pod , you can further diagnose what is happening with kubectl logs $pod -c $container on the pod.在使用kubctl top nodekubectl top pod找到集群中发生的情况后,您可以进一步诊断 pod 上的kubectl logs $pod -c $container发生了什么。

At this point, it is up to the container to provide information on what it is doing, so ideally, you would collect metrics in the pods to get a quick insight into what is happening on your cluster using eg Grafana.此时,由容器提供有关它正在做什么的信息,因此理想情况下,您可以在 pod 中收集指标,以便使用 Grafana 等快速了解集群上发生的事情。 You can also have a look at the resources assigned to your pod using kubectl get pod $pod -o jsonpath='{.spec.containers[].resources}' .您还可以使用kubectl get pod $pod -o jsonpath='{.spec.containers[].resources}'查看分配给您的 pod 的资源。

In your case, the log messages of the kube.netes apiserver should give you a hint.在您的情况下,kube.netes apiserver 的日志消息应该会给您提示。 Probably, something (another container/pod maybe) is clogging up your API server.可能是某些东西(可能是另一个容器/pod)阻塞了您的 API 服务器。

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

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