Skip to content Skip to sidebar Skip to footer

How To Get Pod Cpu And Memory Usage From Metrics-server?

I currently have metric server installed and running in my K8s cluster. Utilizing the the kubernetes python lib, I am able to make this request to get pod metrics: from kubernetes

Solution 1:

Based on the official repository you can query kubelet stats endpoint:

$ curl --insecure https://<node url>:10250/stats/summary

which will return stats of full pods. If you want to see metrics for pod/container itself, type:

$ curl --insecure https://<node url>:10250/{namespace}/{podName}/{uid}/{containerName}

Let's take a look for example:

{"podRef":{"name":"py588590","namespace":"myapp","uid":"e0056f1a"},"startTime":"2019-10-16T03:57:47Z","containers":[{"name":"py588590","startTime":"2019-10-16T03:57:50Z"}]}

These requests will works:

http://localhost:10255/stats/myapp/py588590/e0056f1a/py588590

You can also look for this article. I hope it will helps you.

Post a Comment for "How To Get Pod Cpu And Memory Usage From Metrics-server?"