Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No documentation for pulling an image from the registry #92

Open
S1naHeidari opened this issue Jan 15, 2023 · 1 comment
Open

No documentation for pulling an image from the registry #92

S1naHeidari opened this issue Jan 15, 2023 · 1 comment

Comments

@S1naHeidari
Copy link

Hello everyone,
I am using this helm chart to set up a local docker registry inside my cluster. After I installed the chart, it asks to enter the following two commands:

export POD_NAME=$(kubectl get pods --namespace default -l "app=docker-registry,release=docker-registry" -o jsonpath="{.items[0].metadata.name}")

kubectl -n default port-forward $POD_NAME 8080:5000

Then I was able to push my locally created image to the registry with the following command:
docker push 127.0.0.1:8080/random-scheduler:v1
Now I can pull or push the image using docker, but when I reference this image inside a deployment I get an error. The following is the deployment file that uses random-scheduler:v1 image:

apiVersion: v1
kind: ReplicationController
metadata:
  name: random-scheduler
spec:
  replicas: 1
  selector:
    app: random-scheduler
  template:
    metadata:
      name: random-scheduler
      labels:
        app: random-scheduler
    spec:
      containers:
      - name: random-scheduler-container
        image: 127.0.0.1:8080/random-scheduler:v1
        ports:
        - containerPort: 9999

When I apply this file, the following is the output of kubectl describe of the pod:

Events:
  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  14s                default-scheduler  Successfully assigned default/random-scheduler-cfqvr to k8s-n-2
  Normal   BackOff    11s (x2 over 13s)  kubelet            Back-off pulling image "127.0.0.1:8080/random-scheduler:v1"
  Warning  Failed     11s (x2 over 13s)  kubelet            Error: ImagePullBackOff
  Normal   Pulling    0s (x2 over 13s)   kubelet            Pulling image "127.0.0.1:8080/random-scheduler:v1"
  Warning  Failed     0s (x2 over 13s)   kubelet            Failed to pull image "127.0.0.1:8080/random-scheduler:v1": rpc error: code = Unknown desc = failed to pull and unpack image "127.0.0.1:8080/random-scheduler:v1": failed to resolve reference "127.0.0.1:8080/random-scheduler:v1": failed to do request: Head http://127.0.0.1:8080/v2/random-scheduler/manifests/v1: dial tcp 127.0.0.1:8080:
connect: connection refused
  Warning  Failed     0s (x2 over 13s)   kubelet            Error: ErrImagePull

What is the correct way to reference this image inside my deployment?

@S1naHeidari S1naHeidari changed the title No documentation to for pulling an image from the registry No documentation for pulling an image from the registry Jan 15, 2023
@IanMoroney
Copy link

old thread, but @S1naHeidari , instead you can try the image reference as:
docker-registry:5000/random-scheduler:v1

if you have the docker-registry deployed inside the same kubernetes cluster as random-scheduler, then you don't need to use the port forward, you just have to point the deployment at the registry in the same namespace.

If the deployment is in a different namespace to the docker-registry, then include the namespace in the host reference.
i.e. `mynamespace.docker-registry:5000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants