9

How to change our k8s cluster from docker.io to our private registry so we don't have to mention the docker registry host on every image?

Ivan Aracki
  • 4,861
  • 11
  • 59
  • 73
user3544428
  • 357
  • 1
  • 3
  • 9
  • image pull secrets can be created and then the path to container registry can be given – Tushar Mahajan Feb 03 '21 at 11:46
  • [How to change the default docker registry from docker.io to my private registry?](https://stackoverflow.com/questions/33054369/how-to-change-the-default-docker-registry-from-docker-io-to-my-private-registry) discusses this in the pure-Docker case; unless you have a mirror of Docker Hub it's not usually considered a good idea. Making it a configurable parameter in a Helm chart could be one reasonable approach. – David Maze Feb 03 '21 at 12:25
  • @DavidMaze, could you post it as an answer ? – mario Feb 03 '21 at 21:12

2 Answers2

1

you could set your MutatingAdmissionWebhook to modify image.spec.containers.image values

I wouldn't recommend doing this though.

Ernst
  • 174
  • 1
  • 3
-6

This is a Community Wiki answer partially based on other user's comments, so feel free to edit it and add any additional details you consider important.

As you can read in this section of the official kubernetes documentation, it can be configured on a container runtime level ( in this case Docker ) by creating a Secret based on existing Docker credentials and later you can refer to such alternative cofiguration in your Pod specification as follows:

apiVersion: v1
kind: Pod
metadata:
  name: private-reg
spec:
  containers:
  - name: private-reg-container
    image: <your-private-image>
  imagePullSecrets: 
  - name: regcred
mario
  • 9,858
  • 1
  • 26
  • 42