Pull image from a private registry [K8s] using secret

If you created a private registry, and want to pull the image in k8s deployment. So how to use username/password for registry in k8s deployment or pod.

It would be great to use secret, Documented in k8s as well


  1. Create secret for your registry

kubectl create secret docker-registry regcred –docker-server=<your-registry-server> –docker-username=<your-name> –docker-password=<your-pword> –docker-email=<your-email>

2. Kubectl get secret regcred –output=yaml

3. Use secret while creating pod

Working as an Architect, Infra designer. If any query related to Infra Design [related to cloud,vmware,openstack], please write: amit@openwriteup.com