sakshi123:
Hi Team , Which command can I use to check the memory actually consumed by a pod which has been terminated by “OOMKILLED(container Limit reached)” .I checked the output of "kubectl describe " command but it shows nothing ? Please advise.
Mohamed Ayman:
Hello @sakshi123,
You need to install metrics server to check the memory usage but, if you want to check it without installing metrics, you can get the memory and CPU usage of a pod from cgroup.
- Go to pod’s exec mode kubectl exec -it <pod_name> – /bin/bash
- Go to
cd /sys/fs/cgroup/memory
for memory usage runcat memory.usage_in_bytes
sakshi123:
Thanks @Mohamed Ayman for the feedback . As the pod has been terminated . I don’t think we can execute kubectl exec -it <pod_name> – /bin/bash command and check inside the pod
Mohamed Ayman:
If you have a metric server, you can use kubectl top pod
unnivkn:
Hi @sakshi123 Please go through this: https://sysdig.com/blog/troubleshoot-kubernetes-oom/ Alternatively you may install k8s monitoring tools like prometheus, grafana to monitor the metrics.