<p>I have implemented Liveness Probe in C# based Kubernetes Application. When I am removing InitialDelaySeconds in my <em>livenessconfig</em> (at code level using <a href="https://github.com/kubernetes-client/csharp/blob/225bb1f59b650e6849858f52608ef917b2484ddb/src/KubernetesClient/generated/Models/V1Probe.cs#L66" rel="nofollow noreferrer">Kubernetes Client's V1Probe</a>):</p>
<pre><code>IList&lt;string&gt; command = new List&lt;string&gt;();
V1Probe livenessconfig = null;
command.Add(&quot;curl&quot;);
command.Add(&quot;- f&quot;);
command.Add(&quot;http://localhost:5000/checkhealth/&quot;);
V1ExecAction execommand = new V1ExecAction(command);
livenessconfig = new V1Probe { Exec = execommand, PeriodSeconds = 10};
</code></pre>
<p>then I am seeing Liveness Probe failing in Pod description(no reason is mentioned though):</p>
<pre><code>  Normal   Created    26s               kubelet            Created container App-prox
  Normal   Started    26s               kubelet            Started container App-prox
  Warning  Unhealthy  6s (x2 over 16s)  kubelet            Liveness probe failed:
  Normal   Killing    6s                kubelet            Stopping container App-prox
</code></pre>
<p><strong>I don't want to give any initialdelay to my probe and want my probe to start executing command as soon as container is up.</strong> How should I manage this?</p>

solveit
<p>By providing <code>initialDelaySeconds</code> you basically giving enough time to your container so that your container can be up perfectly. You want your probe to start executing command as soon as your container is up, and how would you do that? by providing <code>initialDelaySeconds</code>.</p>
<p>If a container is restarted and the <code>initialDelaySeconds</code> parameter is not long enough or not given then probe can fail. You need to provide <code>initialDelaySeconds</code> so that containers can be reliably restarted, otherwise your probe will fail because of having the risk of never starting the application.</p>
<p>And, <code>initialDelaySeconds</code> parameter should be longer than maximum initialization time for your container.</p>
<h1>Update</h1>
<p>The <code>kubelet</code> uses liveness probes to know when to restart a container. There are couple of terms in liveness probe, like:  <code>periodSeconds</code>, <code>initialDelaySeconds</code>. <code>periodSeconds</code> specifies that the <code>kubelet</code> should perform a liveness probe every <code>periodSeconds</code> seconds and the <code>initialDelaySeconds</code> tells the <code>kubelet</code> that it should wait <code>initialDelaySeconds</code> seconds before performing the first probe.</p>
