In k8s, there is no such thing like Port x80xx is already being used by another application.
Now let me explain why: As you know, you have to have a service to expose your application/pods running in k8s cluster.Here, Each service you create will have a unique new k8s cluster internal ip assigned to it.So if you have another service with same port, you will not get that error(Port x80xx is already being used by another application). As that particular error will be raised only when two application tried to get the same ip and port(socket).
Now come to the point of ingress: Basically ingress is implemented based on the ingress controller pods running in k8s cluster and yes it has a service.So you can assigned it to any service port(there is pre-defined port) as it will get assigned new cluster ip to it.
Now to expose your service outside of the cluster: To expose your service outside the cluster, you can use serviceType either load balancer and nodeport.
NodePort: A NodePort is an open port on every node of your cluster.As this a port of your node(host machine),you can not assigned one port to multiple service as this will not have different ip rather than a single localhost ip.
Answer of your questions:
- Does this mean the ingress will occupy port 80 of the node? Then if I have another application want to use the port 80 will cause an error?
yes, if you expose your ingress controller service with nodePort 80, then no other service can use this port(Port x80xx is already being used by another application. ).Actually you can not do that cause kubernetes only allow nodePort with range above than 30000.
- If the answer to my first question is “yes”, then is it possible to config an Ingress to listen to the other port on a node.
Yes you can use any other port (typically 30000–32767) as NodePort to expose your ingress service and in that case you have to use url like
CLICK HERE to find out more related problems solutions.