3
votes

I build docker images on one server and then load it onto to the nodes(using docker save and docker load cmds).

Then I make change to the dep_config file to pull it locally instead of repo.(by setting imagepullpolicy).

After that step I do "kubectl apply -f dep_config.yml".

Now, the pod restarts only for the 1st time but subsequent load of images and apply of config file, the pods dont restart.

Is there way I can restart the pod with "kubectl apply" even if there is no change in the config_deploy.yml file.

1

1 Answers

7
votes

A common practice is to change a non-used label of the deployment using the patch command

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

Basically you can change anything that's inside the pod template, even things, like in this example, that no one notices.