What's New In IT Edge?
 

Copying Kubernetes Secrets Between Namespaces

Pro-Tip – Copying Kubernetes Secrets Between Namespaces

by Stephen Spencer

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 -

Have a comment or suggestion? comments@revsys.com

©2002–2019 Revolution Systems, LLC. All rights reserved