How to re-deploy (rolling update) kubernetes deployment if the files don't change

6/27/2019

Say we have this in a deployment.yml

containers:
  - name: my_container
    imagePullPolicy: Always
    image: my_image:latest

and so redeployment might take the form of:

kubectl set image deployment/my-deployment my_container=my_image

which I stole from here:

https://stackoverflow.com/a/40368520/1223975

my question is - is this the right way to do a rolling-update? Will the above always work to make sure the deployment gets the new image? My deployment.yml might never change - it might just be my_image:latest forever, so how to do rolling updates?

-- Alexander Mills
eks
kubectl
kubernetes

1 Answer

6/27/2019

I don't expect this to be an accepted answer. But I wanted to make it for the future as there is a command to do this in Kubernetes 1.15.

PR https://github.com/kubernetes/kubernetes/pull/76062 added a command called kubectl rollout restart. It is part of Kubernetes 1.15. In the future you will be able to do:

kubectl rollout restart deployment/my-deployment
-- Andy Shinn
Source: StackOverflow