<p>I use Google Kubernetes Engine and I intentionally put an error in the code. I was hoping the rolling update will stop when it discovers the status is <code>CrashLoopBackOff</code>, but it wasn't.</p>

<p>In this <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="noreferrer">page</a>, they say.. </p>

<blockquote>
  <p>The Deployment controller will stop the bad rollout automatically, and
  will stop scaling up the new ReplicaSet. This depends on the
  rollingUpdate parameters (maxUnavailable specifically) that you have
  specified.</p>
</blockquote>

<p>But it's not happening, is it only if the status <code>ImagePullBackOff</code>?</p>

<p>Below is my configuration.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: volume-service
  labels:
    group: volume
    tier: service
spec:
  replicas: 4
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 2
      maxSurge: 2
  template:
    metadata:
      labels:
        group: volume
        tier: service
    spec:
      containers:
      - name: volume-service
        image: gcr.io/example/volume-service:latest
</code></pre>

<p>P.S. I already read liveness/readiness probes, but I don't think it can stop a rolling update? or is it?</p>

Hana Alaydrus
<p>Turns out I just need to set <code>minReadySeconds</code> and it stops the rolling update when the new replicaSet has status <code>CrashLoopBackOff</code> or something like <code>Exited with status code 1</code>. So now the old replicaSet still available and not updated.</p>

<p>Here is the new config.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: volume-service
  labels:
    group: volume
    tier: service
spec:
  replicas: 4
  minReadySeconds: 60
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 2
      maxSurge: 2
  template:
    metadata:
      labels:
        group: volume
        tier: service
    spec:
      containers:
      - name: volume-service
        image: gcr.io/example/volume-service:latest
</code></pre>

<p>Thank you for averyone help!</p>
