<p>Currently I am using this in my pipeline</p>
<pre><code>kubectl apply -f deployment.yaml &amp;&amp; kubectl rollout status -f deployment.yaml
</code></pre>
<p>With this in yaml</p>
<pre><code>      readinessProbe:
        tcpSocket:
          port: 90
        initialDelaySeconds: 120
        periodSeconds: 10
        timeoutSeconds: 10
        failureThreshold: 1
        successThreshold: 1
      livenessProbe:
        tcpSocket:
          port: 90
        initialDelaySeconds: 120
        periodSeconds: 20
        timeoutSeconds: 2
        failureThreshold: 1
        successThreshold: 1
</code></pre>
<p>For me, kubectl rollout is running for a very long time, blocking the deployment pipeline. From <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#-em-status-em-" rel="nofollow noreferrer">the documentation</a></p>
<blockquote>
<p>By default 'rollout status' will watch the status of the latest rollout until it's done</p>
</blockquote>
<p>My question:</p>
<p>1/ Which actions are the parts that contribute to the deployment &quot;until it's done&quot; (resource creation, resource teardown?... )</p>
<p>2/ Does readinessProbe and livenessProbe contribute to the deployment time</p>

<p>The criteria for this are <a href="https://github.com/kubernetes/kubectl/blob/24d21a0/pkg/polymorphichelpers/rollout_status.go#L76-L89" rel="noreferrer">in the <code>kubectl</code> source</a>.  A deployment is &quot;complete&quot; if:</p>
<ul>
<li>It hasn't timed out</li>
<li>Its updated-replica count is at least its desired-replica count (every new pod has been created)</li>
<li>Its current-replica count is at most its updated-replica count (every old pod has been destroyed)</li>
<li>Its available-replica count is at least its updated-replica count (every new pod is running)</li>
</ul>
<p>You can use <code>kubectl get deployment -w</code> or <code>kubectl get pod -w</code> to watch a deployment actually happen in real time; the <code>kubectl get -w</code> option watches the given resources and prints out a new line whenever they change.  You'll see the following sequence occur (with default Deployment settings, one at a time for &quot;small&quot; deployments):</p>
<ol>
<li>A new pod is created</li>
<li>The new pod passes its probes and become ready</li>
<li>An old pod is terminated</li>
<li>The old pod actually exits and is deleted</li>
</ol>
<p>So for <code>kubectl rollout status deployment/...</code> to finish, all of these steps must happen – new pods are created, new pods all pass their health checks, old pods are destroyed – for every replica in the deployment.</p>
