how to get max usage of mem and cpu usage of pod on kubernetes

Viewed 6659

I defined my deployment resources

    resources:
      limits:
        cpu: 900m
        memory: 2500Mi

now on http://localhost:8001/api enter image description here

how can I get the max usage of memory and cpu (in order to handle and define usages and resources well)?

5 Answers

Some tools like kubectl top can only get the resource usage of your pod in current time. You need a monitor service.

kube-state-metrics -> prometheus -> grafana-kubernetes-app is a popular solution to monitor metrics of self deployed k8s cluster.

kube-state-metrics can generates metrics about the state of k8s objects, such as node, pod, deployment.

you just need to trace metrics kube_pod_container_resource_requests_cpu_cores and kube_pod_container_resource_requests_memory_bytes as the document specified.

peometheus should collect metrics from kube-state-metrics every few seconds and generate time series data.

grafana-kubernetes-app charts them easily. You can find the maximum cpu usage of a given pod then.

Related