High CPU consumption on pods.

Sai Theja 21 Reputation points
2023-02-07T22:23:14.34+00:00

We are receiving continuous alerts on high CPU usage on pods,

How to troubleshoot and find out which process is causing high CPU on containers.

Please help on this, as there no pids associated in containers nothing is available to check which process is running with high CPU consumption.

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,871 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Andrei Barbu 2,576 Reputation points Microsoft Employee
    2023-02-08T07:39:43.94+00:00

    Hello Sai!

    You may want to use kubectl exec command to connect to your pods (for example, if bash is installed "kubectl exec -it <podname> -n <namespace> -- bash") and run the following command to sort the PIDs and PPIDs based on highest CPU consumption:

    ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head
    
    

    I hope this is helpful. If any clarification needed, let me know and I will do my best to answer.

    Please "Accept as Answer" and Upvote if it helped, so that it can help others in the community looking for help on similar topics.

    Thank you!