Kubernetes - run job after pod status is ready

9/25/2019

I am basically looking for mechanics similair to init containers with a caveat, that I want it to run after pod is ready (responds to readinessProbe for instance). Are there any hooks that can be applied to readinessProbe, so that it can fire a job after first sucessfull probe?

thanks in advance

-- Ɓukasz
kubernetes
kubernetes-jobs
readinessprobe

2 Answers

9/25/2019

Correct me if I am wrong, but you want to run a job when the container is ready.

When you define a job, it will run when the container is up&ready. What are you exactly trying to execute?

-- AYA
Source: StackOverflow

9/25/2019

you can use some short lifecycle hook to pod or say container.

for example

lifecycle:
      postStart:
        exec:
          command: ["/bin/sh", "-c", "echo In postStart > /dev/termination-log"]

it's postStart hook so I think it will work.

But Post hook is async function so as soon as container started it will be triggered sometime may possible before the entry point of container it triggers.

-- Harsh Manvar
Source: StackOverflow