How can I alert for container restarted?

I used the following Prometheus alert rule for finding container restarts in an hour(can be modified to max time), It may be helpful for you. Prometheus Alert Rule Sample ALERT ContainerRestart/PodRestart IF rate(kube_pod_container_status_restarts[1h]) * 3600 > 1 FOR 5s LABELS {action_required = “true”, severity=”critical/warning/info”} ANNOTATIONS {DESCRIPTION=”Pod {{$labels.namespace}}/{{$labels.pod}} restarting more than once during last one hours.”, … Read more

Memory usage discrepancy: cgroup memory.usage_in_bytes vs. RSS inside docker container

I don’t know if you already find your answer or not but let me give you some information that may help. cAdvisor extract many memory-related metrics. We will focus on: container_memory_usage_bytes = value in /sys/fs/cgroup/memory/memory.usage_in_bytes file. (Usage of the memory) container_memory_working_set_bytes = container_memory_usage_bytes – total_inactive_file (from /sys/fs/cgroup/memory/memory.stat), this is calculated in cAdvisor and is <= … Read more