Join K8s subdomain infrastructure with existing DNS

Hi, I prepare to migrate my Docker infrastructure to Kubernetes. Now I am using Docker+SWARM
But, I can’t find information how to manage internal kubernetes DNS.

Maybe someone can help me.

I have that case:

  1. I have WAN infrastructure with domain,com - We have our DNSs
  2. I’ve just created Kubernetes cluster with 3 nodes
  3. I have created 3 namespaces inside of K8s as stages ( UAT,PRE-PROD,PROD)
  4. All of this namespaces will have have replica sets ( with nginx,php-fpm)
    5.For all statges I would like to have unique subdomain per stage example:
    uat,domain,com
    pre,domain,com
    prod,domain,com

When I will create Replica set for namespace UAT, I would like to start PODs (nginx and php-fpm) with service name in my domain:
svc,namespace,domain,com for example: web1,uat,domain,com

I my infrastructure DNS I can set forward DNS request to Kubernetes stack.

Finally I would like to reach host web1,uat,domain,com from outside of Kubernetes cluster.

The question is, How to configure Kubernetes cluster for it.

Thanks, I hope it is clear what I try to do :smiley:
Marcin

Hi Marcin.

You need to install Ingress controller and create dedicated Ingress and Service documents in each namespace with different host names (Ingress gets endpoints from Service and Service can find your Pods). Your DNS records should point to Ingress controller. More information: Ingress - Kubernetes

There are several Ingress controllers which you can choose, for instance NGINX Ingress Controller https://kubernetes.github.io/ingress-nginx/user-guide/basic-usage/

Regards,
Tomasz Prus