Unable to hit ExterName Service domains

Service.yaml file:

kind: Service
apiVersion: v1
name: google
type: ExternalName
externalName: www.google.com

  • name: https
    protocol: TCP
    port: 443

When I am trying to hit this ExternalName Service I am getting below Error
404 Http Response

Whereas, if I hit the domain url (google.com) directly from the pod getting 200 OK response.
kubectl exec curl -n mock-test – curl -sSv www.google.com --insecure

Also I am able to achieve the example mentioned below:

Can someone please help me on how to connect external domains(ex: google.com) via K8’s service

you are not able to curl host name, are you able to ping ? What is the cat /etc/hosts within your POD ?

Thanks for you Reply.
Here, the answer for your question:
/ $ cat /etc/hosts

Kubernetes-managed hosts file. localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters curl

Hello @CoderCooker ,
Could you please help us here. Awaiting for your inputs, Please Let me know in case if you require any further details.


you are not able to curl host name, are you able to ping ?
:point_up_2: you forgot to answer this

You do not have a DNS entry resolving external Host Name. that’s your issue.