What happens when a pod exceeds its memory limit?

0 votes
When a pod exceeds its memory limit? What happens?
Jul 19 in Kubernetes by Athira
123 views

1 answer to this question.

0 votes
  • Whenever a pod exceeds its memory limit a signal SIGKILL is sent which  immediately terminates the container and spawns a new one with OOM(out of memory) error. 

  • The OS, if using a cgroup based containerisation (docker, rkt, etc), will do the OOM killing. 

  • Kubernetes simply sets the cgroup limits but is not ultimately responsible for killing the processes.

  • 'SIGTERM ' is sent to PID 1 and k8s waits for (default of 30 seconds) `terminationGracePeriodSeconds` before sending the `SIGKILL` or you can change that time with terminationGracePeriodSeconds in the pod.

  • As long as your container will eventually exit, it should be fine to have a long grace period. If you want a graceful restart it would have to do it inside the pod. 

  • If you don't want it killed, then you shouldn't set a memory `limit` on the pod and there's not a way to disable it for the whole node. 

  • Also, when the liveness probe fails, the container will SIGTERM and SIGKILL after some grace period.

answered Jul 19 by Sirajul
• 40,980 points

Related Questions In Kubernetes

0 votes
1 answer

How to terminate a pod when a specific event occurs?

You need to add a liveness and ...READ MORE

answered Jul 19 in Kubernetes by Sirajul
• 40,980 points
40 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
3,381 views
+3 votes
1 answer
0 votes
1 answer

What happens when a master or worker node fails?

Whenever master node under kubernetes fails, the ...READ MORE

answered Jul 15 in Kubernetes by Sirajul
• 40,980 points
53 views
0 votes
1 answer

Is there a way to make a pod to automatically come up when the host restarts?

Yes using replication controller but it may ...READ MORE

answered Jul 19 in Kubernetes by Sirajul
• 40,980 points
39 views