How to fix "the object has been modified"?
Last Updated: 2024-09-20
You may have seen this error:
the object has been modified; please apply your changes to the latest version and try again
One possible cause is that you applied a dirty manifest (yaml), maybe previously dumped from an existing object, which contains fields such as creationTimestamp
, resourceVersion
, etc.
You can manually clean up the manifest, or use a command like this:
$ kubectl get KIND NAME -n NAMESPACE -o json | \
jq "del(.status, .metadata.annotations, .metadata.creationTimestamp,
.metadata.finalizers, .metadata.generation,
.metadata.resourceVersion, .metadata.uid)" > object.json