How do I redeploy everything in kubernetes after updating a dockerfile?

Viewed 38054

I'm very new to kubernetes and all I want to do at this point is restart my cluster and have it run an updated dockerfile. I'm running kubernetes in google-cloud-platform by the way.

3 Answers

You can use kubectl patch to trigger a redeploy for example adding a new label.

$ kubectl patch deployment your_deployment -p "{\"spec\": {\"template\": {\"metadata\": { \"labels\": {  \"redeploy\": \"$(date +%s)\"}}}}}"

And now you should see a new ReplicaSet trying to deploy new pods for you!

https://www.kevinsimper.dk/posts/trigger-a-redeploy-in-kubernetes

(I also made it into a shortcut that can apply it to all deploys that match some sort of filter)

Related