I'm trying to delete an existent job using
kubectl delete job/job-name -n my-namespace
But this error is displayed
caling the resource failed with: Job.batch "kong-loop" is invalid:
spec.template: Invalid value: api.PodTemplateSpec{...}: field is
immutable; Current resource version 12189833
The solution posted by @esnible does work in this scenario, but it is simpler do these steps:
kubectl delete job/jobname -n namespace --cascade=false
kubectl delete pod/podname -n namespace
Solution found at in this google groups discussion https://groups.google.com/forum/#!topic/kubernetes-users/YVmUgktoqtI
kubectl does an HTTP PUT to the job during the delete process. This PUT fails because the Job has gotten itself into an invalid state. We must DELETE without PUTing.
Try
kubectl proxy
curl -X DELETE localhost:8001/apis/batch/v1/namespaces/<namespace>/jobs/<jobname>
Then kill the kubectl proxy process. namespace is typically default
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With