The app that runs in the Pod does some refreshing of its data files on start. I need to restart the container each time I want to refresh the data. (A refresh can take a few minutes, so I have a Probe checking for readiness.)
I will run a scheduled job to do a rolling-update kind of deploy, which will take the old Pods out, one at a time and replace them, without downtime.
How do I trigger a deploy, if I haven't changed anything??
Also, I need to be able to do this from the scheduled job, obviously, so no manual editing..
Any other ways of doing this?
Their Role in Building and Managing Software As we now know, a pod is the smallest unit of Kubernetes used to house one or more containers and run applications in a cluster, while deployment is a tool that manages the performance of a pod.
In short, a pod is the core building block for running applications in a Kubernetes cluster; a deployment is a management tool used to control the way pods behave.
According to documentation:
Note: a Deployment’s rollout is triggered if and only if the Deployment’s pod template (i.e.
.spec.template
) is changed, e.g. updating labels or container images of the template.
You can just use kubectl patch
to update i.e. a label inside .spec.template
.
As of kubectl 1.15, you can run:
kubectl rollout restart deployment <deploymentname>
What this does internally, is patch the deployment with a kubectl.kubernetes.io/restartedAt
annotation so the scheduler performs a rollout according to the deployment update strategy.
For previous versions of Kubernetes, you can simulate a similar thing:
kubectl set env deployment --env="LAST_MANUAL_RESTART=$(date +%s)" "deploymentname"
And even replace all in a single namespace:
kubectl set env --all deployment --env="LAST_MANUAL_RESTART=$(date +%s)" --namespace=...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With