2
votes

So currently i have 2 services in a namespace called "development" that need to handle external traffic, and currently use type:LoadBalancer, and have their own external IPs and DNS records.

I want to start using an ingress controller (nginx) deployed in a separate namespace (called "ingress-controller"), and I have some questions about how the end state will look like

So if I understand correctly, I have to create an ingress in the "development" namespace first, then create the ingress deployment and an external type:LoadBalancer service in the "ingress-controller" namespace and set up a DNS record for the ingress controller's service's external IP. Then I need to change the original 2 services in the "development" namespace to ClusterIP, which will now get traffic because of the Ingress rule.

How will hostnames work? Say my first service had a DNS record of "foo.com", second service was called "bar.com", can I set up ingress rules to route requests to 2 different domains?

2

2 Answers

4
votes

You are already good with the ingress thing. Now you have to use external-dns.

This will create DNS for you which you will specify in your ingress. For example.

- host: foo.com
  http:
    paths:
      - path: /*
        backend:
          serviceName: <your service name>
          servicePort: 80
1
votes

Now that you have already created the ingress rule, what left is setting the DNS record of "foo.com" and "bar.com" to the external ip of the ingress controller service.