How to expose kubernetes nginx-ingress service on public node IP at port 80 / 443?

4/2/2018

I installed ingress-nginx in a cluster. I tried exposing the service with the kind: nodePort option, but this only allows for a port range between 30000-32767 (AFAIK)... I need to expose the service at port 80 for http and 443 for tls, so that I can link A Records for the domains directly to the service. Does anyone know how this can be done?

I tried with type: LoadBalancer before, which worked fine, but this creates a new external Load Balancer at my cloud provider for each cluster. In my current situation I want to spawn multiple mini clusters. It would be too expensive to create a new (digitalocean) Load Balalancer for each of those, so I decided to run each cluster with it's own internal ingress-controller and expose that directly on 80/443.

-- Rotareti
kubernetes
kubernetes-ingress
load-balancing
nginx

2 Answers

4/2/2018

If you want on IP for 80 port from a service you could use the externalIP field in service config yaml. You could find how to write the yaml here Kubernetes External IP

But if your usecase is really like getting the ingress controller up and running it does not need the service to be exposed externally.

-- Pramod V
Source: StackOverflow

12/11/2018

if you are on bare metal so change your ingress-controller service type to NodePort and add a reverse proxy to flow traffic to your ingress-controller service with selected NodePort.

As @Pramod V answerd if you use externalIP in ingress-controller service so you loose real remote address in your EndPoints.

A more complete answer could be found Here

-- Mozafar Gholami
Source: StackOverflow