<p>In kubernetes, we can specify the replica of statefulset/deployment. Sometimes, one or more pods will be problematic. For example, the deployment have 3 replicas, and one pod not work well. How can we keep the problematic pod alive for troubleshooting, while creating a new one, to ensure there are 3 healthy pods ?</p>
<p>There are 4 pods in total</p>
<pre><code>pod-healthy-0 Running
pod-healthy-1 Running
pod-healthy-2 Running
pod-problem-keep-for-debug Running
</code></pre>

Haoyuan Ge
<p>You could use a <code>readinessProbe</code> (<a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/</a>)</p>
<p>This will mark the pod(s) as &quot;not ready&quot; for traffic (they will show as <code>0/1 Ready</code>) if the check fails, and they will therefore not receive any requests. The pods will only be killed if the <code>livenessProbe</code> fails.</p>
