spring-bootkubernetesargocd

Is possible to prevent a pod being stopped/deleted while it's app is doing a certain task?


I'm working on an Spring application with a scheduled job which is called some times during the day, and has a variable duration. This job is also locked for one pod only - using shedlock.

The problem is that we have to care for our deploys to be done only after the job is finished, otherwise it's going to be interrupted and have to be called again from the start.

Would be possible to have any kind of Kubernetes configuration to keep that pod "indestructible" for the duration of that job? Something like sending a sign when starting the job, and other when finishing?


Solution

  • Plain and simple: No. Your process will receive a SIGTERM, then a SIGKILL after a while and then the container is simply killed.

    However, what you could do is to use a message queue which requires explicit acknowledgment of the messages triggering your tasks and acknowledge the respective message when a task is finished.