13

Is it possible to use the Ingress Controller function in Kubernetes without a load balancer (in Digital Ocean).

Is there any other mechanism to allow a domain name to map to a Kubernetes service; for instance if I host two WordPress sites on a Kubernetes cluster:

==> WP Site 1: Node Port 80 ==> WP Site 2: Node Port 8080

How does a domain name map to the container port 8080 without explicitly entering the port number.

Any help is appreciated.

Rutnet
  • 1,533
  • 5
  • 26
  • 48

1 Answers1

5

DNS doesn't support adding port numbers, you need an ingress controller (which essentially acts like a reverse proxy) to do this.

If you install the digital ocean cloud controller manager you'll be able to provision loadbalancers using services with type LoadBalancer. You can then deploy a standard ingress controller, like the nginx ingress controller and give the service type=LoadBalancer.

This then becomes the ingress into your cluster, and you only have a single LoadBalancer, which keeps costs down.

jaxxstorm
  • 12,422
  • 5
  • 57
  • 67
  • 3
    Is it possible to point both domain to the ingress controller and let ingress route base on hostname to the correct pod? Can that eliminate the need of the lb to save cost? – Dat Tran Dec 27 '18 at 19:00
  • 11
    The DO load balancer costs $10/mo; fine for anything making money, but overkill for a side project. It should be possible to map a NodePort external ip to 80 or 443 without going through a load balancer. – Eric Walker Jan 05 '19 at 18:13
  • 2
    @DatTran i had it setup with a NodePort on the Droplet. Than the Droplet got restarted and changed IP. I will now try to configure a 'floating ip' which costs nothing additional as long as it is assigned to a droplet and if it is not assigned, it costs 4,xx $ per month. That should do the trick. – sigi Feb 26 '19 at 13:18
  • 3
    See https://stackoverflow.com/a/55968709/2662 for an approach using an Nginx Ingress without a DO LoadBalancer – rcoup May 03 '19 at 11:17
  • With Kubernetes version 1.14 on DigitalOcean, i'm no longer able to do a NodePort below 30.000 (or i completly forgot what i did in 1.13 but i don't think i changed something). Therefore i gave up and switched to the Digital Ocean Loadbalancer. – sigi Jun 01 '19 at 17:36
  • I just solved it thx to the hint for the nginx ingress controller: The nginx ingress controller doesn't use NodePort but HostPort. HostPort is to a Pod what a NodePort is to a Service. Because i have traefik running as a DaemonSet, my traefik pods will always run on all Nodes and for whatever reason i can use HostPort. Im overthinking this, a LB is not really expensive :) – sigi Jun 01 '19 at 18:02