<p>Currently I am working on a K8S project that requires a log file extractor side car container that works alongside the main container to extract log files from the main container. The sidecar container connects via a java web socket to my machine and I can execute commands to retrieve the log files. The log files are maintained within a shared volume mount which is an emptyDir</p>

<p>That works but I need to prepare for a situation at which the main container crashes. If it does then <br>
a) are both the sidecar container and main container restarted from scratch <br>
b) is just the main container started </p>

<p>And also <br>
c) is the shared volume re initialized as an emptyDir <br>
d) all the existing files kept</p>

<p>If case a) or c) occurs what are the termination signals used to terminate the side car container. I plan to use some sort of shutdown hook to listen to it and execute the commands manually before it terminates.</p>

Ranika Nisal
<p>If a container fails, it is restarted according to its <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy" rel="nofollow noreferrer">restart policy</a>. Other containers in the same Pod and volumes aren't affected.</p>
