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