Shoaib Khan
Shoaib Khan

Reputation: 939

Unable to resolve github.com from OpenShift origin pods

I have a basic OpenShift origin cluster started with oc cluster up

Now, in the default 'MyProject' i wanted to build a source from git repo and it's failing with the error Could not resolve host: github.com; Name or service not known

Even I tried setting up gogs and migrate the public hosted source code on github.com to gogs pod but throwing same error.

Kindly advise if there are any additional network settings required during OpenShift cluster setup in order to access github.com or any other public domains. I can sense it's a network issue but not sure what exactly needs to be configured on the cluster.

Upvotes: 5

Views: 3013

Answers (3)

Charith Jayasanka
Charith Jayasanka

Reputation: 4822

Shutdown the cluster with: oc cluster down

Edit the file: openshift.local.clusterup/node/node-config.yml and set dnsIP: "" to 8.8.8.8 Edit the file openshift.local.clusterup/kubedns/resolv.conf

and add

nameserver 8.8.8.8
nameserver 8.8.4.4

Also make sure you have the DNS options inside the docker config file

Edit /etc/docker/daemon.json and add

"dns": ["8.8.8.8", "8.8.4.4"]

Then start your cluster with

oc cluster up

and now it should work fine.

Upvotes: 0

Mohit Dhingra
Mohit Dhingra

Reputation: 51

You can edit the config Map of Node in master server ( In order to provide proper information of your nameserver to the pods.)

# oc get cm -n openshift-node

for all compute nodes edit the config map by below command.( Only need to perform in master server)

#  oc edit cm node-config-compute  -n openshift-node

......
dnsBindAddress: 127.0.0.1:53
    dnsDomain: cluster.local
    dnsIP: 10.0.80.11
    dnsNameservers: null
    dnsRecursiveResolvConf: /etc/origin/node/resolv.conf
.......

Edit dnsIP section with your DNS IP. Then restart the service

# systemctl restart atomic-openshift-node.service

The DNS ip will be prepended in all /etc/resolv.conf file of Pods.

Click for detail info

Upvotes: 1

Bob Claerhout
Bob Claerhout

Reputation: 821

I know this is an old ticket, but I came across this issue when looking for a solution for my problem. I had exactly the same problem as described in this issue. For me, the problem lies within the combination between Ubuntu 18.04 and docker. I followed solution B from this answer.
Hopefully this helps someone as I've lost a lot of time trying to resolve this issue by looking for the problem as if it was a problem from openshift/okd while the actual cause lies within the combination between docker and ubuntu (at least for me).

Upvotes: 3

Related Questions