Body: <p>I have the following registry service that I can push to using docker push</p>
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: registry
  spec:
    selector:
      app: registry
    ports:
      - protocol: TCP
        port: 5000
        targetPort: 5000
        nodePort: 30500
    type: NodePort
  </code></pre>
  <pre><code>$ docker push 10.0.0.58:30500/block-party:latest
  The push refers to repository [10.0.0.58:30500/block-party]
  e0cd0596ba65: Layer already exists
  b80974699bdb: Layer already exists
  3f69a32a2b31: Layer already exists
  d75fd41110a4: Layer already exists
  2e0d92876e9f: Layer already exists
  a8a738834a4d: Layer already exists
  bf6cd01dee5e: Layer already exists
  52ec5a4316fa: Layer already exists
  latest: digest: sha256:6923ac9281f4ed9c5c2fdb1e70acf906d014a104f130f04bcc7878793f8a3479 size: 1988
  </code></pre>
  <p>Now I would like to use the dependency so I try</p>
  <pre><code>~$ sudo microk8s.ctr images pull registry.network.svc.cluster.local:5000/block-party:latest
  [sudo] password for partyk1d24:
  INFO[0000] trying next host                              error=&quot;failed to do request: Head \&quot;https://registry.network.svc.cluster.local:5000/v2/block-party/manifests/latest\&quot;: dial tcp: lookup registry.network.svc.cluster.local on 127.0.0.53:53: server misbehaving&quot; host=&quot;registry.network.svc.cluster.local:5000&quot;
  ctr: failed to resolve reference &quot;registry.network.svc.cluster.local:5000/block-party:latest&quot;: failed to do request: Head &quot;https://registry.network.svc.cluster.local:5000/v2/block-party/manifests/latest&quot;: dial tcp: lookup registry.network.svc.cluster.local on 127.0.0.53:53: server misbehaving
  </code></pre>
  <p>It seems the problem here is it is using https instead of http and I see in the instructions there is the possibility to use insecure</p>
  <p><a href="https://microk8s.io/docs/registry-private#configuring-microk8s" rel="nofollow noreferrer">https://microk8s.io/docs/registry-private#configuring-microk8s</a></p>
  <p>But even trying to create</p>
  <p>/var/snap/microk8s/current/args/certs.d/registry.network.svc.cluster.local:5000/hosts.toml</p>
  <p>I still get the same error. What am I missing?</p>
  <p>I also tried using the external port</p>
  <pre><code>~$ cat /var/snap/microk8s/current/args/certs.d/10.0.0.58:30500/hosts.toml
  server = &quot;http://10.0.0.58:30500&quot;
  
  [host.&quot;http://10.0.0.58:30500&quot;]
  capabilities = [&quot;pull&quot;, &quot;resolve&quot;]
  </code></pre>
  <p>But still get the same, it tries to use https</p>
  
Comments: CC BY-SA 4.0
Comments: 2024-08-26T20:07:03.443Z
Comments: I do not know mikrok8s, but it looks very clearly to be a DNS problem. registry.network.svc.cluster.local should resolve to an IP where you can access things on :5000. The docker https problem did not access you yet, but also that will.
Comments: peterh
Comments: CC BY-SA 4.0
Comments: 2024-09-01T17:48:05.900Z
Comments: @peterh the question isn't why am I getting an issue it is how do I get microk8s to use http instead of https for the registry. Accessing the registry from either environment (local or on microk8s) is fine if http is used instead
Comments: Jackie
Tags: <kubernetes>
Title: How do I access a local docker registry from another deployment?
UserDisplayName: Jackie
ThreadText: # How do I access a local docker registry from another deployment?
  
  (Asked by: username_0 on 2024-08-23)
  
  I have the following registry service that I can push to using docker push
  
  ```
  apiVersion: v1
  kind: Service
  metadata:
    name: registry
  spec:
    selector:
      app: registry
    ports:
      - protocol: TCP
        port: 5000
        targetPort: 5000
        nodePort: 30500
    type: NodePort
  
  ```
  
  ```
  $ docker push 10.0.0.58:30500/block-party:latest
  The push refers to repository [10.0.0.58:30500/block-party]
  e0cd0596ba65: Layer already exists
  b80974699bdb: Layer already exists
  3f69a32a2b31: Layer already exists
  d75fd41110a4: Layer already exists
  2e0d92876e9f: Layer already exists
  a8a738834a4d: Layer already exists
  bf6cd01dee5e: Layer already exists
  52ec5a4316fa: Layer already exists
  latest: digest: sha256:6923ac9281f4ed9c5c2fdb1e70acf906d014a104f130f04bcc7878793f8a3479 size: 1988
  
  ```
  
  Now I would like to use the dependency so I try
  
  ```
  ~$ sudo microk8s.ctr images pull registry.network.svc.cluster.local:5000/block-party:latest
  [sudo] password for partyk1d24:
  INFO[0000] trying next host                              error="failed to do request: Head \"https://registry.network.svc.cluster.local:5000/v2/block-party/manifests/latest\": dial tcp: lookup registry.network.svc.cluster.local on 127.0.0.53:53: server misbehaving" host="registry.network.svc.cluster.local:5000"
  ctr: failed to resolve reference "registry.network.svc.cluster.local:5000/block-party:latest": failed to do request: Head "https://registry.network.svc.cluster.local:5000/v2/block-party/manifests/latest": dial tcp: lookup registry.network.svc.cluster.local on 127.0.0.53:53: server misbehaving
  
  ```
  
  It seems the problem here is it is using https instead of http and I see in the instructions there is the possibility to use insecure
  
  <https://microk8s.io/docs/registry-private#configuring-microk8s>
  
  But even trying to create
  
  /var/snap/microk8s/current/args/certs.d/registry.network.svc.cluster.local:5000/hosts.toml
  
  I still get the same error. What am I missing?
  
  I also tried using the external port
  
  ```
  ~$ cat /var/snap/microk8s/current/args/certs.d/10.0.0.58:30500/hosts.toml
  server = "http://10.0.0.58:30500"
  
  [host."http://10.0.0.58:30500"]
  capabilities = ["pull", "resolve"]
  
  ```
  
  But still get the same, it tries to use https
  
  **Tags:** kubernetes
  
  > **Comments:**
  > **username_1**: I do not know mikrok8s, but it looks very clearly to be a DNS problem. registry.network.svc.cluster.local should resolve to an IP where you can access things on :5000. The docker https problem did not access you yet, but also that will.  
  > **username_0**: @username_1 the question isn't why am I getting an issue it is how do I get microk8s to use http instead of https for the registry. Accessing the registry from either environment (local or on microk8s) is fine if http is used instead  
  
  ---
  
  ## 0 answers
  
  