This alert monitors the RAM usage
in a Kubernetes cluster by calculating the ratio of the memory used by a cgroup to its memory limit. If the memory usage exceeds certain thresholds, the alert triggers and indicates that the system's memory resources are under pressure.
Use the kubectl top nodes
command to check the overall memory usage on the cluster nodes:
kubectl top nodes
Use the kubectl top pods --all-namespaces
command to identify Pods consuming a high amount of memory:
kubectl top pods --all-namespaces
Check the logs of Pods consuming high memory for any issues or misconfigurations:
kubectl logs -n <namespace> <pod_name>
Review the resource limits defined in the Pod's yaml file, particularly the limits
and requests
sections. If you're not setting limits on Pods, then consider setting appropriate limits to prevent running out of resources.
If high memory usage is expected and justified, consider scaling the application by adding replicas or increasing the allocated resources.
If the memory usage is not justified, optimizing the application code or configurations may help reduce memory usage.