Kubernetes: Pull an Image from a Private Registry using Yaml and Helm File

Posted by

Method 1 – Change docker config default registry

To change the default registry for Docker to a private registry that requires authentication, you can follow these steps:

  1. Create or edit the /etc/docker/daemon.json file on your Docker host machine.
  2. Add the following lines to the file, replacing your-registry with the URL of your private registry and your-username and your-password with your registry credentials:
{
  "auths": {
    "your-registry": {
      "auth": "your-username:your-password"
    }
  },
  "registry-mirrors": ["https://your-registry"]
}

Note that the auths key is used to specify the credentials for your private registry, and the registry-mirrors key is used to specify the URL of the registry.

  1. Save the file and exit.
  2. Restart the Docker daemon to apply the changes:
$ sudo systemctl restart docker
  1. Verify that the configuration has been applied by running the docker info command. You should see the URL of your registry listed under “Registry Mirrors”.
$ docker info
...
Registry Mirrors:
  https://your-registry/
...

With this configuration, Docker will use your private registry as the default registry for pulling images and will authenticate with your registry credentials.

Method 2 – Create a Secret based on existing credentials using in Pod Spec

Method 3 – Create a Secret based on existing credentials using Helm chart

  • https://stackoverflow.com/questions/49669077/helm-chart-deployment-and-private-docker-repository
Subscribe
Notify of
guest
2 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Jeroen
Jeroen
11 months ago

Good advice!

drad
drad
1 year ago

Your first method (using the daemon.json) is interesting but does not seem to work as docker crashes after a restart. Are you certain that the auths section is correct?

2
0
Would love your thoughts, please comment.x
()
x