<p>Nearly 3 years ago, Kubernetes would <strong>not</strong> carry out a rolling deployment if you had a single replica (<a href="https://stackoverflow.com/questions/45638480/kubernetes-deployment-does-not-perform-a-rolling-update-when-using-a-single-repl">Kubernetes deployment does not perform a rolling update when using a single replica</a>).</p>

<p>Is this still the case? Is there any additional configuration required for this to work?</p>

Chris Stryczynski
<p>You are not required to have a minimum number of replicas to rollout an update using Kubernetes Rolling Update anymore.  </p>

<p>I tested it on my lab (v1.17.4) and it worked like a charm having only one replica. </p>

<p>You can test it yourself using this Katakoda Lab: <a href="https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-interactive/" rel="nofollow noreferrer">Interactive Tutorial - Updating Your App</a></p>

<p>This lab is setup to create a deployment with 3 replicas. Before starting the lab, edit the deployment and change the number of replicas to one and follow the lab steps. </p>

<p>I created a lab using different example similar to your previous scenario. Here is my deployment: </p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template: 
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx-container 
        image: nginx:1.16.1
        ports:
        - containerPort: 80
</code></pre>

<p>Deployment is running with one replica only: </p>

<pre><code>kubectl get pods
NAME                                READY   STATUS    RESTARTS   AGE
nginx-deployment-6c4699c59c-w8clt   1/1     Running   0          5s
</code></pre>

<p>Here I edited my nginx-deployment.yaml  and changed the version of nginx to <code>nginx:latest</code> and rolled out my deployment running replace: </p>

<pre><code>$ kubectl replace -f nginx-deployment.yaml 
deployment.apps/nginx-deployment replaced
</code></pre>

<p>Another option is to change the nginx version using the <code>kubectl set image</code> <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#updating-a-deployment" rel="nofollow noreferrer">command</a>: </p>

<pre><code>kubectl set image deployment/nginx-deployment nginx-container=nginx:latest --record
</code></pre>

<pre><code>$ kubectl get pods
NAME                                READY   STATUS              RESTARTS   AGE
nginx-deployment-566d9f6dfc-hmlf2   0/1     ContainerCreating   0          3s
nginx-deployment-6c4699c59c-w8clt   1/1     Running             0          48s

$ kubectl get pods
NAME                                READY   STATUS        RESTARTS   AGE
nginx-deployment-566d9f6dfc-hmlf2   1/1     Running       0          6s
nginx-deployment-6c4699c59c-w8clt   0/1     Terminating   0          51s

$ kubectl get pods
NAME                                READY   STATUS    RESTARTS   AGE
nginx-deployment-566d9f6dfc-hmlf2   1/1     Running   0          13s
</code></pre>

<p>As you can see, everything worked normally with only one replica. </p>

<p>In the latest version of the <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#updating-a-deployment" rel="nofollow noreferrer">documentation</a> we can read: </p>

<blockquote>
  <p>Deployment ensures that only a certain number of Pods are down while
  they are being updated. By default, it ensures that at least 75% of
  the desired number of Pods are up (25% max unavailable).</p>
  
  <p>Deployment also ensures that only a certain number of Pods are created
  above the desired number of Pods. By default, it ensures that at most
  125% of the desired number of Pods are up (25% max surge).</p>
</blockquote>
