1

The problem I'm trying to solve is horizontal scaling for the web application, where some sessions lead to high CPU usage. The idea is to use Readiness probe to inform K8s that pod is loaded with the current task and new traffic has to be sent to another one (HPA will do the work and prepare a new pod).

But I want that session that processing on the initial pod will be active and once work is done the result will be delivered to the user.

The question is does it mean that if readiness probe fail K8s will:

  1. Stop route ALL traffic to the pod, drop current sessions that open through ingress.
  2. Stop route NEW traffic to the pod, but current sessions will be active during the specified timeout.

Thank you in advance.

Wytrzymały Wiktor
  • 11,492
  • 5
  • 29
  • 37
Dmytro Sirant
  • 118
  • 10

1 Answers1

0

UPDATE

It seems like I was totally not right in my 1st edit. More correct is to specify that It will Stop route NEW traffic to the pod but TCP connections like ssh will still be alive.

When the Endpoints controller receives the notification that the readiness probe failed, it removes the Pod as an Endpoint in the Service that the Pod is a part of. Then API server sends this information to the kube-proxies running on the worker nodes and kube-proxies update the iptables rules on its node, which is what prevents new connections from being forwarded to this Pod. However it's worth knowing that the TCP protocol is a stateful protocol (unlike HTTP) so existing connections (e.g ssh sessions) will still be active.

Vit
  • 7,740
  • 15
  • 40