Arshanvit
Arshanvit

Reputation: 467

Change location of Docker Registry inside Kubernetes Pods

I am novice to Kubernetes. Recently my Docker registry url is changed from dockerhub.abc.com to dockerhub.def.com. Is it possible that i can change this in properties of Kubernetes pod so that next time,it pulls from new registry?

Upvotes: 1

Views: 648

Answers (2)

David Maze
David Maze

Reputation: 159393

In general you'll find it easiest if you explicitly qualify your image names to include the repository name, and not depend on a default value that isn't the official Docker Hub

image: dockerhub.abc.com/dist/image:1.2.3

in which case you can just change the image name in your deployment

image: dockerhub.def.com/dist/image:1.2.3

If you're using a system like Helm to manage your Kubernetes manifests, you might find it helpful to include the image base name and/or repository in its values file

image: dockerhub.abc.com/dist/image
tag: 1.2.3

image: {{ printf "%s:%s" .Values.image .Values.tag }}

and then you can just change the image's repository location and redeploy.

Upvotes: 1

Cemal Unal
Cemal Unal

Reputation: 594

If you're using secrets to hold your authorization token for your Docker registry, you can refer to using private registry

I recommend you to use secrets. All you need to do is create a new secret or update the existing one with your new url, and then put this secret to your Pod's .yaml.

apiVersion: v1
kind: Pod
metadata:
  name: private-reg
spec:
  containers:
  - name: private-reg-container
    image: <your-private-image>
  imagePullSecrets:
  - name: <your-secret-name>

Upvotes: 1

Related Questions