Change NodePort to 80 in baremetal

4/2/2019

If i use node port in yml file it give a port more than 30000 but when my user want to use it they do not want to remember that port and want to use 80. my kubernetes cluster is on baremetal. How can i solve that?

-- yasin lachini
kubernetes

2 Answers

4/2/2019

Kubernetes doesn't allow you to expose low ports via the Node Port service type by design. The idea is that there is a significant chance of a port conflict if users are allowed to set low port numbers for their Node Port services.

If you really want to use port 80, you're going to have to either use a Load Balancer service type, or route your traffic through an Ingress. If you were on a cloud service, then either option would be fairly straight forward. However, since you're on bare metal, both options are going to be very involved. You're going to have to configure the load balancer or ingress functionality yourself in order to use either option, and it's going to be rough, sorry.

If you want to go forward with this, you'll have to read through a bunch of documentation to figure out what you want to implement and how to implement it.

https://www.weave.works/blog/kubernetes-faq-how-can-i-route-traffic-for-kubernetes-on-bare-metal

-- Swiss
Source: StackOverflow

4/2/2019

According to api-server docs you can use --service-node-port-range parameter for api-server or specify it to kubeadm configuration when bootstrapping your cluster see github issue

-- SKorolchuk
Source: StackOverflow