Skip to content

Pulling from private registry

Using existing credentials from Docker config file

  1. Delete an existing secret if you have one; kubectl delete secret regcred
  2. Create a new secret named regcred with contents from config.json file;
sh
kubectl create secret generic regcred --from-file=.dockerconfigjson=/home/nwero/.docker/config.json --type=kubernetes.io/dockerconfigjson
  1. Verify that the secret has been created successfully and Kubelet should be able to pull images from private registry

Creating a secret from terminal

  1. Delete an existing secret if you have one; kubectl delete secret regcred
  2. Create a new secret named regcred with your details in command-line;
sh
kubectl create secret docker-registry regcred --docker-server=<registry> --docker-username=<username> --docker-password=<password>
  • <registry> is your private container registry, e.g https://ghcr.io
  • <username> is your username for the registry you want to log into
  • <password> is your password for the registry
  1. Verify that the secret has been created successfully and Kubelet should be able to pull images from private registry