<p>I'm running this command:</p>

<pre><code>kubectl set image deployment/www-deployment VERSION_www=newImage
</code></pre>

<p>Works fine.  But there's a 10 second window where the website is 503, and I'm a perfectionist.  </p>

<p><strong>How can I configure kubernetes to wait for the image to be available before switching the ingress?</strong></p>

<p>I'm using the nginx ingress controller from here:</p>

<pre><code>gcr.io/google_containers/nginx-ingress-controller:0.8.3
</code></pre>

<p>And this yaml for the web server:</p>

<pre><code># Service and Deployment
apiVersion: v1
kind: Service
metadata:
  name: www-service
spec:
  ports:
  - name: http-port
    port: 80
    protocol: TCP
    targetPort: http-port
  selector:
    app: www
  sessionAffinity: None
  type: ClusterIP
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: www-deployment
spec:
  replicas: 1
  template:
    metadata:
      labels: 
        app: www
    spec:
      containers:
      - image: myapp/www
        imagePullPolicy: Always
        livenessProbe:
          httpGet:
            path: /healthz
            port: http-port
        name: www
        ports:
        - containerPort: 80
          name: http-port
          protocol: TCP
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        volumeMounts:
        - mountPath: /etc/env-volume
          name: config
          readOnly: true
      imagePullSecrets:
      - name: cloud.docker.com-pull
      volumes:
      - name: config
        secret:
          defaultMode: 420
          items:
          - key: www.sh
            mode: 256
            path: env.sh
          secretName: env-secret
</code></pre>

<p>The Docker image is based on a <a href="https://github.com/nodejs/docker-node/blob/master/4.5/slim/Dockerfile" rel="nofollow noreferrer">node.js server image</a>.</p>

<p><code>/healthz</code> is a file in the webserver which returns <code>ok</code>  I thought that liveness probe would make sure the server was up and ready before switching to the new version.  </p>

<p>Thanks in advance!</p>

<p>within the <a href="https://kubernetes.io/docs/user-guide/pod-states/" rel="nofollow noreferrer">Pod lifecycle</a> it's defined that:</p>

<blockquote>
  <p>The default state of Liveness before the initial delay is Success.</p>
</blockquote>

<p>To make sure you don't run into issues better configure the <code>ReadinessProbe</code> for your Pods too and consider to configure <code>.spec.minReadySeconds</code> for your Deployment.</p>

<p>You'll find details in the <a href="https://kubernetes.io/docs/user-guide/deployments" rel="nofollow noreferrer">Deployment</a> documentation</p>
