activeDeadlineSeconds but only for the time the container is running

8/4/2021

In a kubernetes cluster, I want to set a deadline for how long a container in a pod is allowed to run (the container will run to completion).

I'm aware of activeDeadlineSeconds, but when set, the clock starts ticking when the pod is started, not the container. This means that there's some variable time taken by pulling the container image, mounting volumes, etc.

For my application, I want to exclude this time overhead and set a deadline, starting when the container begins running. I have observed that the containers may take a variable amount of time to start running, so adding a constant amount of time to activeDeadlineSeconds would not work for me. Additionally, I can't modify the containers or inject anything into them, they need to run as provided by a 3rd party.

Is it possible to achieve this behavior?

-- ButterDog
containers
deadline-timer
kubernetes
kubernetes-pod

0 Answers