Created
January 26, 2018 15:28
-
-
Save denniswebb/a00cc8eabc79e60e97747488614af8bb to your computer and use it in GitHub Desktop.
Copy Kubernetes secret from 1 namespace to another
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
#!/usr/bin/env bash | |
SECRET_NAME=$1 | |
SRC_NS=$2 | |
DST_NS=$3 | |
kubectl -n ${SRC_NS} get secret ${SECRET_NAME} -o yaml | sed "/resourceVersion/d" | sed "/creationTime/d" | sed "/selfLink/d" | sed "/uid/d" | sed "s/namespace: ${SRC_NS}/namespace: ${DST_NS}/g" | kubectl apply -f - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment