DNS does not resolve with NGINX in Kubernetes

0 votes

I have a kubernetes cluster with AWS. 

I'm trying to run a custom NGINX configuration which uses DNS resolutions to proxy_pass. 

location /api/v1/lead {
  resolver ipv6=off;
  set $container lead-api;
  proxy_pass http://$container:3000;

I get the following error in the NGINX logs of the Kubernetes cluster

[error] 9#9: *20 lead-api could not be resolved (2: Server failure), client:, server: , request: "GET /api/v1/lead/661DF757-722B-41BB-81BD-C7FD398BBC88 HTTP/1.1"
Aug 30, 2018 in Kubernetes by Hannah
• 18,570 points

2 answers to this question.

0 votes
use the Full Qualified Domain name. That is, you should use:


not just

answered Aug 30, 2018 by Kalgi
• 52,370 points
0 votes

adding to @kalgi's answer

Using just the hostname will usually work because in kubernetes the resolv.conf is configured with search domains so that you don't usually need to provide a service's FQDN. e.g:

search default.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
answered Aug 30, 2018 by Nilesh
• 7,040 points

Related Questions In Kubernetes

0 votes
1 answer

How does DNS work in kubernetes?

DNS is a built-in service in Kubernetes. ...READ MORE

answered Jul 12, 2019 in Kubernetes by Sirajul
• 59,090 points
0 votes
1 answer

Not able to access kubernetes api from a pod in azure

Follow these steps Add --bind-address= option to the line https://github.com/kubernetes/kubernetes/blob/v1.2.0/docs/getting-started-guides/coreos/azure/cloud_config_templates/kubernetes-cluster-main-nodes-template.yml#L218  Created ...READ MORE

answered Aug 30, 2018 in Kubernetes by Kalgi
• 52,370 points
0 votes
1 answer
0 votes
1 answer

Ingress nginx loading resource 404 in kubernetes

This is not a routing problem on ...READ MORE

answered Sep 10, 2018 in Kubernetes by Kalgi
• 52,370 points
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
+2 votes
1 answer
0 votes
1 answer

Error saying "The specified bucket does not exist" in kubernetes

Bucket is created in another region. Looks like ...READ MORE

answered Aug 31, 2018 in Kubernetes by Kalgi
• 52,370 points
+1 vote
1 answer