FreeThreads
Published in

FreeThreads

Fix Kubernetes Cron Job invalid: spec.template field is immutable

The Kubernetes job on apply fails.

kubectl apply -f /home/my.job.yaml

Error

The Job "xyz" is invalid: spec.template: Invalid value: core.PodTemplateSpec{ObjectMeta:v1.ObjectMeta{:} field is immutable

Solution

The job once applied, can’t be re-applied.

We should delete the job as follows and apply again.

kubectl delete -f /home/my.job.yaml

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Simplify Complexity

Simplify Complexity

422 Followers

Golang, Distributed Systems, File Systems, Python, C/C++, Linux