I'm trying to export some kube resources (configmaps, deployments, services) from one cluster so that it can be applied to another.

Something like this ....

kubectl --kubeconfig ${src} -n ${ns} get configmaps ${cm} -o yaml | \
 kubectl --kubeconfig ${dst} -n ${ns} apply -f -

It kind works, once. The first time where the resource hasn't been created yet. If I run it a second time, trying to update the destination I get error like...

**the object has been modified; please apply your changes to the latest version and try again.**

I suspect it has something to do with the resourceVersion or timestamp fields that appear in the output.

Is there away to output a resource so that is striped of all server side specific info? Other that a bunch of sed delete and grep -v statements.

TIA