Ashish Vyas
Ashish Vyas

Reputation: 617

Can init container be a kubernetes job

Is it possible to have a kubernetes job as init container for my kubernetes pod?

I want to start my kubernetes pod/ deployment only after the kubernetes job has successfully reached completed state. If above is not possible, is there any other way out? I can not use an external script to check kubectl wait --for=condition=complete etc and then start my pod.

Upvotes: 1

Views: 1552

Answers (1)

Nepomucen
Nepomucen

Reputation: 6577

Yes, you can safely use the same pod spec in Init container, as you used before in Job object. If you need to implement more sophisticated workflows please take a look at Argo Workflow framework - for doing things done on Kubernetes. Here is an example of Conditionals usage.

Upvotes: 2

Related Questions