Home > Software design >  Kubernetes graceful pod termination on SpringApplication.exit
Kubernetes graceful pod termination on SpringApplication.exit

Time:11-25

I'm trying to terminate a Kubernetes pod, which only contains one container, when the app in the container exits. I'm using a "kind:deployment" to run the pod, and the application is terminating with "SpringApplication.exit". However the pod is restarting, rather than terminating. Does anyone have any idea how I can get the pod to terminate, rather than restart? All advice gratefully received!

CodePudding user response:

If you are not running a web application but a task that does some work and finishes, then you should go with a Job:

https://kubernetes.io/docs/concepts/workloads/controllers/job/

If you want to perform your task periodically, then use a cronjob:

https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/

  • Related