search by tags

for the user

adventures into the land of the command line

k8s, nginx ingress and websockets

if you're using an nginx cluster ingress controller and a cluster autoscaler and have many teams deploying and scaling apps which use the cluster ingress and you have one app that uses websocket connections...

your websocket connections are gonna get dropped every time the cluster ingress controller reloads its configuration.

this option:

worker-shutdown-timeout

set in the cluster ingress's config map, to a time value like 30s or 10m, will hold off on reloading the configuration for existing connections by spinning up a new configured number of workers without shutting down the current ones, every time nginx receives a reload signal, until the configured time passes or there're no longer any active connections.

important note though: if you have a controller reloading nginx enough times then you can get your pod OOM killed. so you need to watch your memory utilisation.

it's outlined in this issue here.