Updating a kubernetes job: what happens?

5/28/2019

I'm looking for a definitive answer for k8s' response to a job being updated - specifically, if I update the container spec (image / args).

If the containers are starting up, will it stop & restart them?

If the job's pod is all running, will it stop & restart?

If it's Completed, will it run it again with the new setup?

If it failed, will it run it again with the new setup?

I've not been able to find documentation on this point, but if there is some I'd be very happy to get some signposting.

-- Kieren Johnstone
kubernetes

1 Answer

5/28/2019

The .spec.template field can not be updated in a Job, the field is immutable. The Job would need to be deleted and recreated which covers all of your questions.

The reasoning behind the changes aren't available in the github commit or pr, but these changes were soon after Jobs were originally added. Your stated questions are likely part of that reasoning as making it immutable removes ambiguity.

-- Matt
Source: StackOverflow