<p>I am trying to setup gitlab pipeline which builds and deploys to kubernetes. I am at step where i do</p>

<pre><code>kubectl apply -f Application-k8s-file.yaml
</code></pre>

<p>and </p>

<pre><code>kubectl rollout status deployment deployment_name
</code></pre>

<p>as you can see i am using rolling updates. Even though kubernetes deployment failed, i see status as waiting for pod. How do i make sure that my job fails when kubernetes deployment fails.</p>

Hacker
<p>Check if you're setting the <code>.spec.progressDeadlineSeconds</code> field. It denotes the number of seconds the Deployment controller waits before indicating that the Deployment progress has stalled.</p>

<p>This will cause the <code>kubectl status rollout</code> command to fail after X amount of seconds.</p>

<pre><code>kubectl rollout status deployment.v1.apps/nginx-deployment
Waiting for rollout to finish: 2 out of 3 new replicas have been updated...
error: deployment "nginx" exceeded its progress deadline
$ echo $?
1
</code></pre>

<p>More information: <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#progress-deadline-seconds" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#progress-deadline-seconds</a></p>
