<p>I have progressDeadlineSeconds set to 120 seconds </p>

<p>I deploy and run <code>kubectl rollout status deployment mydeployment</code></p>

<p>The deployment failed with <code>0 of 1 updated replicas available - CrashLoopBackOff</code></p>

<p>But the kubectl is still hanging forever with message: <code>Waiting for deployment "mydeployment" rollout to finish: 0 of 1 updated replicas are available...</code> </p>

<p>Why is this happening, progressDeadlineSeconds is suppose to force it to fail and cause <code>kubectl rollout status deployment</code> to exit with a non-zero return code right?</p>

red888
<p>You are correct, <code>kubectl rollout status</code> returns a non-zero exit code if the Deployment has exceeded the progression deadline. <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#progress-deadline-seconds" rel="noreferrer">Progress Deadline Seconds</a>:</p>

<blockquote>
  <p><code>.spec.progressDeadlineSeconds</code> is an optional field that specifies
  the number of seconds you want to wait for your Deployment to progress
  before the system reports back that the Deployment has failed
  progressing - surfaced as a condition with <code>Type=Progressing</code>,
  <code>Status=False</code>. and <code>Reason=ProgressDeadlineExceeded</code> in the status of
  the resource. The Deployment controller will keep retrying the
  Deployment. This defaults to 600. In the future, once automatic
  rollback will be implemented, the Deployment controller will roll back
  a Deployment as soon as it observes such a condition.</p>
  
  <p>If specified, this field needs to be greater than
  <code>.spec.minReadySeconds</code>.</p>
</blockquote>

<p>Which brings us to <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#min-ready-seconds" rel="noreferrer">Min Ready Seconds</a></p>

<blockquote>
  <p><code>.spec.minReadySeconds</code> is an optional field that specifies the
  minimum number of seconds for which a newly created Pod should be
  ready without any of its containers crashing, for it to be considered
  available. This defaults to 0 (the Pod will be considered available as
  soon as it is ready).</p>
</blockquote>

<p>Without your exact deployment configs it is hard to tell where the problem is but there are few things to check out:</p>

<ul>
<li><p>Try setting both the <code>progressDeadlineSeconds</code> and <code>minReadySeconds</code> remembering that the later must have a smaller value.</p></li>
<li><p><code>progressDeadlineSeconds</code> might not be respected when used with <code>Replicas: 1</code>. Check your <code>maxUnavailable</code> param in order to see if it allows deployment full unavailability. </p></li>
<li><p>As a workaround you can specify a timeout period for your <code>kubectl rollout status</code> command. For example: <code>kubectl rollout status deployment mydeployment --timeout=120s</code></p></li>
<li><p>If you don't want to wait for the rollout to finish then you can use <code>--watch=false</code>. You will than have to check the status manually by running <code>kubectl describe deployment</code> and <code>kubectl get deployment</code> commands which might not be ideal.</p></li>
</ul>

<p>Please let me know if that helps.</p>
