Delete a pod but mark the job as successful

5/13/2019

I have a system that brings up Jobs, each with a Pod that has multiple containers.

Two of those containers are not under my control and run "background"/sidecar daemons. The container I do control is able to run to completion, but once it's done, the Pod is still considered active since two of the containers are still up.

I've tried killing the other containers from mine, but that works ~99% of the time and we run a lot of Jobs. When it fails, deleting the Pod (or letting the Job timeout) works, but it marks the Job as a failure rather than as a success, and I use that status to indicate to users the result of their work.

Edit: I'm aware of the "sidecar containers" KEP, but no PR has been accepted for it yet, so it's not going to be available in a stable cluster for a very long time.

-- fahhem
kubernetes

1 Answer

5/14/2019

Don't know to what extent this answers your question, but it seems that there is an ongoing discussion about sidecar containers, and an enhancement proposal about this also.

An interesting solution proposed in the thread above is this k8s-controller-sidecars proposed by a user, and which seems easy to configure.

Try it out, and let us know if it works.

-- Anas Tiour
Source: StackOverflow