Last active
May 17, 2021 08:29
-
-
Save gpr/3bda2659e917371321e7bbd6f98f1835 to your computer and use it in GitHub Desktop.
[Copy secrets among different namespaces] #kubernetes #k8s #secrets
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
#!/bin/bash | |
# | |
# Example: ./kubectl-copy-secret.sh s3access default gitlab-runnner | |
SECRET_NAME=${1:?} | |
NS_SRC=${2:?} | |
NS_SRC=${3:?} | |
kubectl get secret $SECRET_NAME \ | |
--namespace=$NS_SRC \ | |
-o yaml | \ | |
yq r - 'metadata.annotations."kubectl.kubernetes.io/last-applied-configuration"' \ | |
kubectl apply --namespace=$NS_SRC -f - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment