Forked from simonswine/copy-k8s-resources-across-namespaces.sh
Last active
April 25, 2018 18:45
-
-
Save pandeybk/20809559381aeb5afd390e1447c336bc to your computer and use it in GitHub Desktop.
kubectl handy gist
This file contains hidden or 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
# Copying kubernetes resources accross namespaces | |
kubectl get rs,secrets -o json --namespace old | jq '.items[].metadata.namespace = "new"' | kubectl create -f - | |
kubectl get cm -o json --namespace old some-config-map | jq '.metadata.namespace = "new"' | kubectl create -f - | |
# kubectl exec in each pods | |
for pod in `kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'`; do echo $pod date:; kubectl exec -it $pod -- date ; echo "--------------"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment