Why am I getting ENOTFOUND error with Axios on Kubernetes

5/27/2019

I am using axios npm package to invoke an kubernetes service in Google Kubernetes Environment. My NodeJS application is hosted as a Kubernetes Deployment along with this another service which it is trying to invoke.

I get ENOTFOUND error when this service is invoked , my code looks something like this , where some-service is an Kubernetes service.

let endpointUrl = 'http://some-service/path/';
axios.get(endpointUrl,...  

I tried to get into my Pod and run a nslookup and curl from within it and it was successful. I am also able to invoke the service from axios using the LoadBalancer IP. I see there are many unanswered questions around this topic which deals with either NodeJs or Proxy ( I am not behind any proxy, both services are hosted in GKE ).

-- fatcook
axios
kubernetes
node.js

1 Answer

8/20/2019

I had this same issue. It was a bug in the alpine linux dns resolution system...

we worked around it changing the base image from node to centos

-- Techmago
Source: StackOverflow