OpenStack – How do I retrieve CPU usage from Node in Kubernetes via API?

I want to use the Kubernetes API to calculate and display node-specific CPU usage percentages in my own web application.

I need to communicate with Kube UI It displays the same information as Cadvisor, but I want to use the Kubernetes API.

I found some cpu indicators under node-ip: 10255 / stats, which contain timestamps, cpu usage: total number, users and system I don’t understand. In addition, the CPU-Limit is reported as 1024.

How does Kube UI calculate the CPU usage? Is it possible to perform the same operation through the API?

If you use Kubernetes v1.2, there will be a new and clearer metric Summary API. Starting from the release notes: Kubelet has published a new Alpha indicator API in a user-friendly format – /stats/summary, which reduces system overhead.

You can use : 10255/stats/summary and detailed API objects are here to access the endpoint.

I want to use the Kubernetes API to calculate and display node-specific cpu in my own web application Usage percentage.

I need to display the same information as Kube UI and Cadvisor, but I want to use Kubernetes API.

I am under node-ip: 10255/stats I found some cpu metrics, including timestamps, cpu usage: total number, large weird number of users and systems, I don’t understand. In addition, CPU-Limit is reported as 1024.

How does Kube UI calculate CPU usage? Rate, is it possible to perform the same operation through the API?

If you use Kubernetes v1.2, there will be a new and clearer metric summary API. From the release notes: Kubelet is user-friendly The format of the API exposes the new Alpha indicator API – / stats / summary, which reduces system overhead.

You can pass : 10255 / stats / summary and detailed API objects are here Access the endpoint.

Leave a Comment

Your email address will not be published.