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
.
To acquire a static IP for the ingress-nginx-controller, simply put it behind a Service of Type=LoadBalancer . Then, update the ingress controller so it adopts the static IP of the Service by passing the --publish-service flag (the example yaml used in the next step already has it set to "ingress-nginx-lb").
With this service-type, Kubernetes will assign this service on ports on the 30000+ range. Run the get svc command to see a summary of the service and the ports exposed. Now you can verify that the Nginx page is reachable on all nodes using the curl command. As you can see, the “WELCOME TO NGINX!” page can be reached.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With