Home > Back-end >  Kubernetes Ingress automated way to expose services
Kubernetes Ingress automated way to expose services

Time:10-15

Consider I have a domain name www.saireddy.com

When ever a deployment, services deployed in kubernetes on dev namespace eg servicename: nginx-svc, port: 80

I want an automated way to access this services on url link www.nginx-svc.dev.saireddy.com

in the same way if I deploy a different service on uat namespace eg servicename: tomcat, port: 8080 then it should be accessible at link www.tomcat.uat.saireddy.com

Every time adding a ingress in yaml is a pain for dev cluster this will be super beneficial. I wonder how kodekloud manages to do the same because when I deploy services in the lab I can instantly able to access the exposed url’s for that services with out any ingress files.

All the above with only a single ALB for all the namespaces in aws. Is there any solution for these kind of situation.

CodePudding user response:

This is possible using a combination of an Ingress Controller and an automated tool to create DNS entries, such as External DNS

For example, you can install the Nginx Ingress Controller and External DNS in the cluster.

With this combination, as soon as the ingress controller "claims" the ingress, External DNS will create a DNS entry that maps the name in the ingress to the IP managed by the Ingress Controller.

CodePudding user response:

The traditional way would be to use wildcard DNS records.

You could have *.dev.my-domain.comm *.int, *.prod, ... all pointing to your kubernetes ingress controllers.

Then, kubernetes users can setup their own Ingresses, within those domains. No need to change your DNS configuration.

The External DNS suggested by @blender-fox also makes sense, if you can integrate with it. Although I would be careful when granting clusters privileges to change DNS records in my main domains ... It would be a god sent to any attacker trying to spoof your records ...

  • Related