Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

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

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
1 year 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?

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

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