dina
dina

Reputation: 4289

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

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)?

Upvotes: 2

Views: 8506

Answers (5)

kentor
kentor

Reputation: 18514

A little late to the party, but I created Kube Eagle for exactly this purpose: https://github.com/google-cloud-tools/kube-eagle

Kube Eagle dashboard

Upvotes: 1

dina
dina

Reputation: 4289

if you are running on GKE

for now day, the kubernetes console has advanced and you can see all statistics on the console ui

go to https://console.cloud.google.com/kubernetes/list

under workloads choose the deployment

enter image description here

Upvotes: 1

Vi.Ci
Vi.Ci

Reputation: 5115

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.

Upvotes: 1

dina
dina

Reputation: 4289

Usually, you will need to implement some monitoring solution for your K8s cluster to store historical metrics.

If your Kubernetes deployment runs on GKE, you can use Stackdriver for that and if you have opted for Stackdriver Premium, you will see your historical metrics there. If it's your own Kubernetes deployment, Prometheus/Grafana is a popular choice

Upvotes: 2

Mayur Nagekar
Mayur Nagekar

Reputation: 811

By default the pods run with unbounded CPU and memory limits. This means that any pod in the system will be able to consume as much CPU and memory as is on the node that executes the pod.

Reference: https://kubernetes.io/docs/tasks/administer-cluster/cpu-memory-limit/

Upvotes: 1

Related Questions