Does K8s stop traffic to pod before restarting container on OOM

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: 1.26
Cloud being used: (put bare-metal if not on a public cloud) NA
Installation method: NA
Host OS: NA
CNI and version: NA
CRI and version: NA

We are using a Azure managed K8s cluster. Recently there was an upgrade to 1.25 and we faced OOM issue as our containers were still on a legacy JDK. And it was not able to communicated with CGroupsV2 for resource allocation and ending up in OOM. The status was OOMKilled during this time and the container restarts back and runs again.

The containers were getting restarted close to 5 times a day.
We wanted to know what could be the impact for the requests which are still processing while the container is getting restarted.

Will Kubernetes stop traffic to pod before restarting the container on OOM.

No. It’s the kernel that does the kill, and it does not consider network.

1 Like

So, the threads which were processing would have been killed. And since the network is still live, the calls will try reaching the pod and fail ?

If it is TCP, the OS’s stack will send RST when a packet arrives. If the client was waiting for a response, they will be waiting until timeout.

If it was UDP, well, you get UDP behavior.