Difference between revisions of "Yq"
Jump to navigation
Jump to search
Line 3: | Line 3: | ||
``` | ``` | ||
https://github.com/mikefarah/yq | https://github.com/mikefarah/yq | ||
+ | |||
+ | Dump all | ||
+ | ``` | ||
+ | mkdir -p tmp | ||
+ | cd tmp | ||
+ | |||
+ | for OBJ in $(kubectl api-resources --verbs=list --namespaced -o name) | ||
+ | do | ||
+ | for DEF in $(kubectl get --show-kind --ignore-not-found $OBJ -o name) | ||
+ | do | ||
+ | mkdir -p $(dirname $DEF) | ||
+ | echo $DEF | ||
+ | |||
+ | kubectl get $DEF -o yaml \ | ||
+ | | yq eval 'del(.metadata.resourceVersion, .metadata.uid, .metadata.annotations, .metadata.creationTimestamp, .metadata.selfLink, .metadata.managedFields)' - > $DEF.yaml | ||
+ | done | ||
+ | ``` | ||
Ref: | Ref: | ||
- https://stackoverflow.com/questions/61392206/kubectl-export-is-deprecated-any-alternative | - https://stackoverflow.com/questions/61392206/kubectl-export-is-deprecated-any-alternative |
Revision as of 17:59, 4 October 2021
kubectl get configMap zabbix-server -oyaml | yq eval 'del(.metadata.resourceVersion, .metadata.uid, .metadata.annotations, .metadata.creationTimestamp, .metadata.selfLink, .metadata.managedFields)' -
https://github.com/mikefarah/yq
Dump all
mkdir -p tmp cd tmp for OBJ in $(kubectl api-resources --verbs=list --namespaced -o name) do for DEF in $(kubectl get --show-kind --ignore-not-found $OBJ -o name) do mkdir -p $(dirname $DEF) echo $DEF kubectl get $DEF -o yaml \ | yq eval 'del(.metadata.resourceVersion, .metadata.uid, .metadata.annotations, .metadata.creationTimestamp, .metadata.selfLink, .metadata.managedFields)' - > $DEF.yaml done
Ref: