kubernetes on aws: Exposing multiple domain names (ingress vs ELB)

1/10/2018

I am experimenting with a kubernetes cluster on aws.

At the end of the day, I want to expose 2 urls:

  • production.somesite.com
  • staging.somesite.com

When exposing 1 url, things (at least in the cloud landscape) seem to be easy.

You make the service LoadBalancer type --> aws provisions an ELB --> you assign an A type alias record (e.g. whatever.somesite.com) to ELB's dns name and boom, there is your service publicly available via the hostname you like.

I assume one easy (and I guess not best-pracise-wise) way of going about this is to expose 2 ELBs.

Is Ingress the (good) alternative?

If so, what is the Route53 record I should create?

For what that matters (and in case this may be a dealbreaker for Ingress):

  • production.somesite.com will be publicly available
  • staging.somesite.com will have restrictive acces
-- pkaramol
amazon-route53
amazon-web-services
kubernetes
networking

1 Answer

1/10/2018

Ingress is for sure one possible solution.

You need to deploy in your cluster an Ingress controller (for instance https://github.com/kubernetes/ingress-nginx) than expose it with a Service of type LoadBalancer as you did previously.

In route53, you need to point any domain names you want to be served by your ingress controller to ELB's name, exactly as you did previously.

The last thing you need to do is create an Ingress resource for every domain you want your ingress controller to be aware of (more on this here: https://kubernetes.io/docs/concepts/services-networking/ingress/).

That being said, if you plan to only have 2 public URLs in your cluster I'd use 2 ELBs. Ingress controller is another component to be maintained/monitored in your cluster, so take this into account when evaluating the tradeoffs.

-- whites11
Source: StackOverflow