<p>I'm trying to do a blue green deployment with kubernetes , I have followed it , <a href="https://www.ianlewis.org/en/bluegreen-deployments-kubernetes" rel="noreferrer">https://www.ianlewis.org/en/bluegreen-deployments-kubernetes</a> , that is ok. 
I have added a liveness probe to execute a healthcheck , </p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: flask-1.3
spec:
  replicas: 2
  template:
    metadata:
      labels:
        name: app
        version: "1.3"
    spec:
      containers: 
        - name: appflask
          image: 192.168.99.100:5000/fapp:1.2
          livenessProbe:
            httpGet:
             path: /index2
             port: 5000
            failureThreshold: 1
            periodSeconds: 1
            initialDelaySeconds: 1
          ports:
            - name: http
              containerPort: 5000
</code></pre>

<p>the path "index2" doesnt exist , I want to test a failed deployment. the problem is when I execute:</p>

<pre><code> kubectl get pods -o wide
</code></pre>

<p>for some seconds one of the pods is in state "RUNNING"</p>

<pre><code>NAME                         READY   STATUS             RESTARTS   AGE     IP             NODE    NOMINATED NODE   READINESS GATES

flask-1.3-6c644b8648-878qz   0/1     CrashLoopBackOff   6          6m19s   10.244.1.250   node    &lt;none&gt;           &lt;none&gt;
flask-1.3-6c644b8648-t6qhv   0/1     CrashLoopBackOff   7          6m19s   10.244.2.230   nod2e   &lt;none&gt;           &lt;none&gt;
</code></pre>

<p>after some seconds one pod is RUNNING when live is failing always:</p>

<pre><code>NAME                         READY   STATUS             RESTARTS   AGE 

    IP             NODE    NOMINATED NODE   READINESS GATES

   flask-1.3-6c644b8648-878qz   1/1     Running            7          6m20s   10.244.1.250   node    &lt;none&gt;           &lt;none&gt;
    flask-1.3-6c644b8648-t6qhv   0/1     CrashLoopBackOff   7          6m20s   10.244.2.230   nod2e   &lt;none&gt;           &lt;none&gt;
</code></pre>

<p>And after RUNNING it back to CrashLoopBackOff, the question is , why for some seconds it keeps RUNNING if the livenesprobe go to fail always?</p>

<p>thanks in advance</p>

Esteban Ziths
<p>You should be looking at <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#define-readiness-probes" rel="nofollow noreferrer">Readiness probe</a> instead, or both of them.</p>

<blockquote>
  <p>Readiness and liveness probes can be used in parallel for the same container. Using both can ensure that traffic does not reach a container that is not ready for it, and that containers are restarted when they fail.</p>
</blockquote>

<p><a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#define-a-liveness-command" rel="nofollow noreferrer">Liveness probe</a> checks if your application is in a healthy state in your <strong>already running pod</strong>.</p>

<p><a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#define-readiness-probes" rel="nofollow noreferrer">Readiness probe</a> will actually check if your pod is ready to receive traffic. Thus, if there is no <strong>/index2</strong> endpoint, it will never appear as <strong>Running</strong></p>
