Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to expose Kubernetes DNS externally

Tags:

kubernetes

Is it possible for an external DNS server to resolve against the K8s cluster DNS? I want to have applications residing outside of the cluster be able to resolve the container DNS names?

like image 693
Chris Avatar asked Apr 24 '19 16:04

Chris


2 Answers

Although it may be possible to expose coredns and thus forward requests to kubernetes, the typical approach I've taken, in aws, is to use the external-dns controller.

This will sync services and ingresses with provides like aws. It comes with some caveats, but I've used it successfully in prod environments.

like image 144
Dan Murphy Avatar answered Sep 21 '22 20:09

Dan Murphy


It's possible, there's a good article proving the concept: https://blog.heptio.com/configuring-your-linux-host-to-resolve-a-local-kubernetes-clusters-service-urls-a8c7bdb212a7

However, I agree with Dan that exposing via service + ingress/ELB + external-dns is a common way to solve this. And for dev purposes I use https://github.com/txn2/kubefwd which also hacks name resolution.

like image 37
Max Lobur Avatar answered Sep 23 '22 20:09

Max Lobur