<p>On a Kubernetes cluster when using HaProxy as an ingress controller. How will the HaProxy add a new pod when the old pod has died.</p>

<p>Does it can make sure that the pod is ready to get traffic into.</p>

<p>Right now I am using a readiness probe and liveness probe. I know that the order in Kubernetes to use a new pod would be first Liveness probe --> Readiness probe --> 6/6 --> pod is ready.</p>

<p>So will it use the same Kubernetes mechanism using HaProxy Ingress Controller ?</p>

Yaniv Hakim
<p>Short answer is: <strong>Yes, it is!</strong></p>

<p><strong>From <a href="https://www.haproxy.com/blog/dissecting-the-haproxy-kubernetes-ingress-controller/" rel="nofollow noreferrer">documentation</a>:</strong></p>

<blockquote>
  <p>The most demanding part is syncing the status of pods, since the environment is highly dynamic and pods can be created or destroyed at any time. The controller feeds those changes directly to HAProxy via the HAProxy Data Plane API, which reloads HAProxy as needed.</p>
</blockquote>

<p>HAProxy ingress don't take care of the pod healthy, it is responsible to receive the external traffic and forward for the correct kubernetes services.</p>

<p><strong>Kubelet</strong> uses liveness and probes to know when to restart a container, it means that you must define <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/" rel="nofollow noreferrer">liveness, readiness</a> in pod definition.<br>
See more about container probes in pod <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/" rel="nofollow noreferrer">lifecycle</a> documentation.</p>

<blockquote>
  <p>The kubelet uses readiness probes to know when a Container is ready to start accepting traffic. A Pod is considered ready when all of its Containers are ready. One use of this signal is to control which Pods are used as backends for Services. When a Pod is not ready, it is removed from Service load balancers.</p>
</blockquote>
