How to copy K8S secret from one namespace to another

K8S SecretK8S Secret
Secrets are [[K8S Object]]s which are used to store sensitive information you can't otherwise put into a Pod spec or a [[K8S ConfigMap]].

Secrets are very similar to ConfigMaps, the biggest differ...
s can't be accessed across different environments. If you want to use an existing secret in another environment, you'll have to copy it there. To copy a secret from one namespace to another, you can use this simple script:

SECRET_NAME=$1
SOURCE_NS=$2
DESTINATION_NS=$3

kubectl get secret $SECRET_NAME --namespace=$SOURCE_NS -o yaml | sed "s/namespace: .*/namespace: $DESTINATION_NS/" | kubectl -n $DESTINATION_NS apply -f -


Status: #📥

References: