<p>I have configured a <code>pod</code> as follows:</p>
<pre><code>  livenessProbe:
    initialDelaySeconds: 60
    periodSeconds: 10
    failureThreshold: 3
  readinessProbe:
    initialDelaySeconds: 60
    periodSeconds: 10
    failureThreshold: 3
</code></pre>
<p>Readiness and Liveness probes are tcp-socker based</p>
<pre><code>          readinessProbe:
            tcpSocket:
              port: {{ .Values.port }}
            initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
            periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
            failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
</code></pre>
<p>However, when I deploy, the pod is marked almost immediately as <code>failed</code> and goes in <code>Error</code> --&gt; <code>CrashLoopBackOff</code>.
The pod checks a redis connection (which does indeed need a little time to become ready).</p>
<p>And of course I see the connection errors in my pod's logs</p>
<pre><code>  File &quot;/usr/local/lib/python3.9/site-packages/redis/connection.py&quot;, line 563, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to redis-master:6379. Connection refused.
</code></pre>
<p>Why is the pod being marked in <code>Error</code> / CLBO so eagerly, way before <code>initialDelaySeconds: 60</code>?</p>
<p>Here is the pod's <code>yaml</code> dump regarding the probes (I increased the <code>initialDelaySecond</code> to both probes to 100, but still the same...)</p>
<pre><code>    livenessProbe:
      failureThreshold: 3
      initialDelaySeconds: 100
      periodSeconds: 10
      successThreshold: 1
      tcpSocket:
        port: 9898
      timeoutSeconds: 1
    name: mycontainer
    ports:
    - containerPort: 9898
      protocol: TCP
    readinessProbe:
      failureThreshold: 3
      initialDelaySeconds: 100
      periodSeconds: 10
      successThreshold: 1
      tcpSocket:
        port: 9898
      timeoutSeconds: 1
</code></pre>

pkaramol
<p><code>initialDelaySeconds</code>: Number of seconds after the container has started before liveness or readiness probes are initiated.</p>
<p>Now pod can get failed because of <code>CrashLoopBackOff</code> even before starting the probes. <strong>This is the concept here</strong>. It can occur if you set the container <code>restartPolicy</code> to <code>Never</code>.</p>
<p>You can see the pod logs or events for getting the reason of pod failure (can use <code>kubectl describe &lt;pod&gt;</code>)</p>
