<p>I have set up a Node app on Kubernetes. I'm running a single replica and I want 0 down-time when the image is updated. I update my Pod using <code>set Image</code> on Kubernetes.</p>

<pre><code>'set', 'image', 'deployment/dev-web'
</code></pre>

<p>Here's my YAML file </p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "2"
  generation: 2
  labels:
    io.kompose.service: dev-web
  name: dev-web
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: dev-web
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        io.kompose.service: dev-web
    spec:
      containers:
      - env:
        image: gcr.io/my-project-link/my-image-link
        imagePullPolicy: Always
        name: dev-web-container
        ports:
        - containerPort: 2000
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /
            port: 2000
            scheme: HTTP
          initialDelaySeconds: 5
          periodSeconds: 5
          successThreshold: 1
          timeoutSeconds: 1
        resources:
          requests:
            cpu: 20m
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status:
  availableReplicas: 1
  conditions:
  - lastTransitionTime: 2018-12-07T11:13:21Z
    lastUpdateTime: 2018-12-07T11:13:21Z
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  observedGeneration: 2
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1
</code></pre>

<p>My app does give 200 response on '/' get therefore Readiness Probe works but when I update the Image, and test it but continuously hitting CURL, it gives me downtime which lasts for like 20-40 seconds. </p>

Alamgir Qazi
<p>You setup your <code>maxUnavailable</code> as 1 even when you have only one replica, you should be having <code>maxUnavailable</code> to 0.</p>

<pre><code>strategy:
 type: RollingUpdate
 rollingUpdate:
   maxUnavailable: 0
   maxSurge: 1
</code></pre>

<p>It basically tells Kubernetes that there should be zero unavailable pods while deploying (<code>maxUnavailable: 0</code>) and there should be one new pod at a time (<code>maxSurge: 1</code>).</p>

<p>I am hoping you setup the <code>readiness</code> probe something like this:</p>

<pre><code>readinessProbe:
  httpGet:
    path: /
    port: 80
  initialDelaySeconds: 5
  periodSeconds: 5
  successThreshold: 1
</code></pre>

<p>Basically, this is a check that Kubernetes does in order to make sure that your pod is ready to send traffic to it. Until it is not ready, Kubernetes will not use your pod.</p>
