Unable to use curl using kubernetes service's dns address

2.1k views Asked by At

I'm trying to perform curl to my pod from another pod in a Kubernetes cluster.

$ kubectl version --short
Client Version: v1.17.0
Server Version: v1.16.14

To do so, I tried the following commands:

$ kubectl run curl-performer --image=radial/busyboxplus:curl -i --tty --rm
If you don't see a command prompt, try pressing enter.

$  curl -XGET http://account-server.console.svc:9090
curl: (6) Couldn't resolve host 'account-server.console.svc'

But nslookup works fine.

$ nslookup account-server.console.svc
Server:    10.245.0.10
Address 1: 10.245.0.10 kube-dns.kube-system.svc.cluster.local

Name:      account-server.console.svc
Address 1: 10.245.87.129 account-server.console.svc.cluster.local

What am I missing here?

Update:

Complete form of DNS address doesn't work either:

$ curl -XGET http://account-server.console.svc.cluster.local:9090
curl: (6) Couldn't resolve host 'account-server.console.svc.cluster.local'
0

There are 0 answers