I have a multi-container pod that has one main container and another supporting container. The main container terminates after completing its process, but the pod stays in "RUNNING" state because the other container is still running. How can I configure Kubernetes to terminate the whole pod (or the other container and subsequently the whole pod) when my main container terminates?
Asked
Active
Viewed 679 times
5
-
Just saw - https://stackoverflow.com/questions/38600622/sidecar-containers-in-kubernetes-pods from 5 years ago. Have there been any updates in Kubernetes that allow it more directly rather than the slightly hacky way mentioned in the answer? – nikochiko Aug 27 '21 at 07:33
-
Which version of Kubernetes did you use and how did you deploy it? – Mikołaj Głodziak Aug 27 '21 at 12:47
-
@MikołajGłodziak 1.18.20 – nikochiko Aug 27 '21 at 17:10
-
How did you run your cluster? Did you use bare metal installation or some cloud providor? – Mikołaj Głodziak Aug 30 '21 at 14:23
-
it is run on a cloud provider, yes – nikochiko Aug 31 '21 at 09:05
-
Which cloud providor did you use? – Mikołaj Głodziak Sep 01 '21 at 07:10
-
Why is that relevant? – nikochiko Sep 01 '21 at 11:40
-
To replicate your problem as close as possible. – Mikołaj Głodziak Sep 01 '21 at 11:52
1 Answers
0
with shared pid namespace you can actually "see" the other process from your sidecar, having that you can track pid of the process you want to react to and exit/restart when that pid changes

Radek 'Goblin' Pieczonka
- 21,554
- 7
- 52
- 48