How to use Kubernetes DNS for pods?

In GKE, kube-dns runs on my nodes, I see docker containers.

I have access to Services by name, which is great for all of these applications, where load balancing is the ideal solution, but how can I use DNS to access individual containers?

I know that I can find specific elements in the API, but I need to update the hosts and keep track of the list of elements. Should DNS do this for me the way it is supposed to be used in a container?

A Kubernetes document says that DNS information needs to be passed to the cube, but I don’t have access to this in GKE, which I know of, so it’s just not configured in that way on GKE or is there something to do to activate it?

Some of my services (in particular, zookeeper) are aware of other nodes and try to connect to them by host name (this is the file name), and this fails if I do not update the hosts file myself. I would like to use the integrated DNS service for this.

Any recommendations on how to do this would be appreciated.

thanks

+5
source share
2 answers

ORIGINAL RESPONSE:

from this date it is actually impossible ... but the Kubernetes team is looking at it.

See this problem: https://github.com/kubernetes/kubernetes/issues/13552

UPDATE

DNS is available for Pods from 09/2015. See PR: https://github.com/kubernetes/kubernetes/pull/13759

:

This will give pods dns in the form <podIP>.<namespace>.pod.<clusterSuffix> Currently you can turn it off, but it is either turned on for all containers or turned off.

+1
source

Kubernetes state support support binds the service name and defines the pod dns name with the service name.

For example, if you create a zk daemonset and a zk service, then the name dns zk daemonset first pod is zk-0. $ (namespace) .svc.cluster.local

more information: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/

0
source

All Articles