Unable to hit ExterName Service domains

Service.yaml file:

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

  • 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.
O/p:
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.

127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters
10.253.206.226 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.

Thanks,
Mahesh

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.

Thanks