validate that image exist when updating kubernetes deployment

7/19/2018

when updating deployment with a none-exist image, Kubernetes first will start terminating the existing pod and will end up with a broken deployment. is it possible to tell kubectl to validate/pull the image before terminating existing pod?

-- Maoz Zadok
google-kubernetes-engine
kubectl
kubernetes

3 Answers

7/19/2018

While I have not tested this I think in theory this should work:

You can use the admission controller AlwaysPullImages and a deployment strategy where at least one pod is up. The admission controller ensures that images are Always pulled before the pod is started.

To enable this admission controller you will have to enable flag at Kubernetes API server like from this link:

kube-apiserver --enable-admission-plugins=AlwaysPullImages,LimitRanger
-- Vishal Biyani
Source: StackOverflow

7/19/2018

Implementing Liveness / Readiness will ensure that old pod gets terminated only if the new pod is healthy.

-- manojkumarm
Source: StackOverflow

7/19/2018

I had to change the strategy.rollingUpdate.maxUnavailable to 0

strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate

I think that the default of strategy.rollingUpdate.maxUnavailable is 1

Thanks Michael Hausenblas

-- Maoz Zadok
Source: StackOverflow