Tidbits | April 29, 2018

Pro-Tip – Copying Kubernetes Secrets Between Namespaces

The secret resource-type is unique--it cannot be accessed from pods outside of its namespace. A simple way of copying common secret data (e.g.: docker registry credentials) between namespaces is provided by the --export flag of kubectl get. Pipe its output to kubectl apply -n <target namespace> -f -, and you are done!

kubectl get secret gitlab-registry --namespace=revsys-com --export -o yaml |\
   kubectl apply --namespace=devspectrum-dev -f -

ops   namespaces   namespace   secrets   kubernetes   k8s  

2018-04-29T14:19:01.391724-05:00 2018-04-29T14:19:01.339590-05:00 2018 ops,namespaces,namespace,secrets,kubernetes,k8s