Google Cloud DNS not resolving | Kubernetes Service

10/24/2019

I have created the below resources in GCP:

  • GKE
  • VPC and associated networks
  • dns zone

I have created a pod with node js app in the same.I have Kubernetes service of type load balancer exposed. when I try to curl into my service with the external IP created , I am able to get response.

Then I tried to map my Google external load balancer IP to 'A' record. When I try to access the same I get the error could not resolve host name

It would be great if I can get some help on the same.

-- Sunil
google-cloud-dns
google-kubernetes-engine

1 Answer

10/25/2019

I understand that you have GKE, VPC and a DNS zone as resources in GCP. You have a pod with node js app, and you have exposed the Kubernetes service of load balancer type, which resolves successfully to the host. You have tried to map your Google external load balancer IP to ‘A’ record, but you are not able to resolve the host name. I will do my best to advise you.

Once you expose the workload to create a service, it creates an ip address exposed to the Internet that will access the application. Requests to that ip address will round robin across all the pods to balance the load accordingly.

As you mentioned that you can curl into your service with the external IP address but not with the domain, it seems to be an issue related with DNS. ‘A’ Record is used to point a logical domain name, such as "google.com", to the IP address of Google's hosting server, "74.125.224.147".

Before we proceed any further, please let me know the following details :

Please make sure A record is there on the Domain registrar and propagated.
Please let me know if the A records are actually resolving to the IP at all. ‘ whatsmydns.net ’ might be helpful to check this out. Please make sure A record is there and propagated.
If the A record is properly setup, please check that the A record properly resolves from the client machine, with nslookup or dig. To query domain ‘A’ record : dig example.com. In the output, you can see that example.com has an A record pointing to the IP address. Or, you can use nslookup example.com for the same. Please try to curl from another machine as well.

In case you are using Cloud DNS from GCP, please make sure the Cloud DNS is setup properly. You can go through the link :1 to create a new record. For information on managing records, please go to the link :2

I will be awaiting your reply. If you have any other questions or concerns about your issue, please do not hesitate to contact me by replying to this message. I will be happy to help.

-- Anurag Sharma
Source: StackOverflow