Kubernetes dependent pods - how to trigger restart of dependent pod?

2/25/2020

I have 2 separate pods that make up one application instance (1 tomcat web server, and 1 postgres db). When the database pod is restarted, the application does not make a new connection to the new database pod, and is stuck in a state where the web server is inaccessible (trying to stay connected to a pod that does not exist?). How can I trigger a restart of the application server once the database pod is restarted (this can be for a host shutdown, maintenance, or any other reason)?

I am currently using init containers to make the initial connection the the database server (if the db is not up, do not start the app pod), this works fine when stating up the pods both manually/initially. But when the app is already running, it seems that it does not make the new connection on the fly.

-- mm_wvu18
containers
kubernetes

0 Answers