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

Can't use docker-registry.default.svc in pod spec #222

Open
phemmer opened this issue Feb 26, 2018 · 4 comments
Open

Can't use docker-registry.default.svc in pod spec #222

phemmer opened this issue Feb 26, 2018 · 4 comments

Comments

@phemmer
Copy link

phemmer commented Feb 26, 2018

If you try to use image: 'docker-registry.default.svc:5000/mynamespace/myimage' in a pod spec, you'll get errors such as:

Failed to pull image "docker-registry.default.svc:5000/mynamespace/myimage": rpc error: code = 2 desc = Get https://docker-registry.default.svc:5000/v1/_ping: dial tcp: lookup docker-registry.default.svc: no such host

This is happening because docker itself uses the host's DNS configuration, which isn't using the kubernetes DNS service.

My own thoughts: It seems like the way to fix this is to ensure the centos image is using dnsmasq (which it currently is not), reroute the cluster.local domain to the kubernetes DNS service, and add the domain to the search list as well.

(ref: openshift/origin#16097)

@cmoulliard
Copy link

Is it fixed ? @LalatenduMohanty

@gbraad
Copy link
Member

gbraad commented Jun 29, 2018 via email

@cmoulliard
Copy link

I can reproduce it locally using this config

minishift v1.20.0+53c500a
- cpus                               : 4
- image-caching                      : false
- iso-url                            : centos
- memory                             : 4G
- openshift-version                  : v3.9.0
- vm-driver                          : xhyve

where the image of the DeploymentConfig is defined as such

        - image: docker-registry.default.svc:5000/k8s-supervisord/copy-supervisord:1.0

Error

Failed to pull image "docker-registry.default.svc:5000/k8s-supervisord/copy-supervisord:1.0": rpc error: code = Unknown desc = Get https://docker-registry.default.svc:5000/v1/_ping: dial tcp: lookup docker-registry.default.svc on 192.168.65.1:53: no such host

@lostiniceland
Copy link

lostiniceland commented Sep 28, 2018

I am having the same problem with 3.10 (installed via openshift-ansible)

[vagrant@master ~]$ cat /etc/resolv.conf 
# nameserver updated by /etc/NetworkManager/dispatcher.d/99-origin-dns.sh
# Generated by NetworkManager
search cluster.local vnet.de
nameserver 192.168.60.150

[vagrant@master ~]$ nslookup master.vnet.de
Server:         192.168.60.150
Address:        192.168.60.150#53
Name:   master.vnet.de
Address: 192.168.60.150

[vagrant@master ~]$ nslookup docker-registry.default.svc          
Server:         192.168.60.150
Address:        192.168.60.150#53
Non-authoritative answer:
Name:   docker-registry.default.svc
Address: 62.138.239.45
Name:   docker-registry.default.svc
Address: 62.138.238.45

[vagrant@master ~]$ nslookup docker-registry.default.svc.cluster.local
Server:         192.168.60.150
Address:        192.168.60.150#53
Name:   docker-registry.default.svc.cluster.local
Address: 172.30.142.227

I am no expert on networking but since the DNS only resolves cluster.local and my custom domain vnet.de, just having docker-registry.default.svc probably resolves to an unreachable network.

EDIT:
The solution provided here worked with some minor changes.
On each node I've updated /etc/dnsmasq.d/origin-upstream-dns.conf with server=/default.svc/172.30.0.1 and restarted dnsmasq.

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

No branches or pull requests

4 participants