I have a k8s loadbalancer in front of some pods. When I deploy updated pods a certain amount of traffic to the pods will timeout and fail - it basically seems like k8s will handle the pod update/deploy as expected, but the loadbalancer will be unaware of this and will just continue to send traffic to all pods, until it seems liveness monitors fail and only then stop sending traffic to the pods.
What I'd love to see is the following scenario:
- mark a pod offline in the loadbalancer, so no new traffic is sent there - but without having the pod restarted
- update/replace pod
- send traffic to the new pod when it responds 200 to readiness probe
This way I wouldn't get any timeouts. So, how to achieve this? Or is it just me having a bad config, as it's not working?
Edit:
I have both readiness and liveness probes set up. The config for these:
readinessProbe:
httpGet:
path: /ready
port: 8080
periodSeconds: 1
initialDelaySeconds: 5
livenessProbe:
httpGet:
path: /alive
port: 8080
periodSeconds: 1
failureThreshold: 2
initialDelaySeconds: 40
However, at a surface level, this does not fix the problem: if the loadbalancer will only stop sending traffic after a probe fails, and k8s starts bringing down a pod without notifying the loadbalancer, then there will be failed requests. It doesn't matter how I tweak the values above - periodSeconds has a minimum value of 1 second.
I am considering experimenting with the readiness probe though - to see if I can take a pod offline without restarting it, before starting deploy. Not exactly optimal, but maybe a way forward.