Created
December 12, 2017 14:34
-
-
Save danrigsby/8346b842d1446628de5223b600668dca to your computer and use it in GitHub Desktop.
Copy kubernetes secrets between namespaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl get secrets -o json --namespace old | jq '.items[].metadata.namespace = "new"' | kubectl create -f - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TIL jq let's you access items in a list like
.items[].foo
, that's super useful. You can actually do the following then:kubectl get secrets -o json --namespace old | jq 'del(.items[].metadata.namespace)' | kubectl create -f --namespace new