I am running Jenkins in Kubernetes, specifically using the jenkins/jenkins: docker image in the pod spec to run the Jenkins instance. Is there any documentation or steps on how to upgrade the Jenkins core version when running it in Kubernetes? The automatic upgrade in the UI does not work, because when the Jenkins pod restarts, the image downloads the war file with the version in the image tag. So Jenkins never gets upgraded. I have to manually edit the K8s deployment, and change the image to jenkins/jenkins: to successfully upgrade.
Couple questions:
1. Is this the right way to upgrade? What happens when there are conflicts between the two versions (like changes to directory structure , for example), and how can I resolve that?
2. When we update the docker image tag, the current pod (pod A) will terminate and a new pod (pod B) gets spun up with the new image. I noticed that the pod A does not do any clean up before terminating.
When I try to upgrade the Jenkins instance with the upgrade button in the UI, the cleanUp() method ( is called before the pod restarts (I saw the logs). (Note that this upgrade does not work because the docker image tag still has the old core version, but I was just testing what the upgrade button does)
How can I safely clean up Jenkins running on pod A before it terminates?
I have tried safeExit API which does clean up, but then the K8s Jenkins master pod restarts, which I don't want to happen.