Pulling images from private registry in Kubernetes

ghz 1years ago ⋅ 8553 views

Question

I have built a 4 node kubernetes cluster running multi-container pods all running on CoreOS. The images come from public and private repositories. Right now I have to log into each node and manually pull down the images each time I update them. I would like be able to pull them automatically.

  1. I have tried running docker login on each server and putting the .dockercfg file in /root and /core
  2. I have also done the above with the .docker/config.json
  3. I have added secret to the kube master and added imagePullSecrets:
  • name: docker.io to the Pod configuration file.

When I create the pod i get the error message Error:

image <user/image>:latest not found

If I log in and run docker pull it will pull the image. I have tried this using docker.io and quay.io.


Answer

Kubernetes supports a special type of secret that you can create that will be used to fetch images for your pods. More details [here](https://kubernetes.io/docs/concepts/containers/images/#specifying- imagepullsecrets-on-a-pod "Specifying image pull secrets on a pod").