I’m running Jenkins in a Kubernetes container, and I see that when the pod is deleted, the clean up method for Jenkins is not called. However, when I upgrade the Jenkins version through the Jenkins UI, the application is cleaned up as part of shutting down.
Does Jenkins code handle the TERM/SIGTERM signal (which Kubernetes sends to the application when the pod is being terminated) at all?
Otherwise, how can I ensure that my Jenkins application is properly cleaned up when running it in a Kubernetes container?
Thanks @halkeye - we ended using the PreStop K8s hook and running a script that will call the safeExit api, so we can clean up the Jenkins instance before the container terminates.