I'm working on some scripts for modifying configmaps, but while I'm working on that, I need a way to restore the configmap from a backup. In my script, I first write out the configmap to a file, in case the modification doesn't work properly, which is presently the case.
I'm basically just doing this:
cat /tmp/tmpfile | kubectl replace <configmapname> -f -".
However, this fails with:
Error from server (Conflict): error when replacing "STDIN": Operation cannot be fulfilled on configmaps "<configmapname>": the object has been modified; please apply your changes to the latest version and try again"
I don't understand what I need to do here.