Why port number is different

why the port number used in the yaml file is 8080. I checked the service and it looks like a ClusterIP type service. Can anyone please explain.

The ingress is connecting a ClusterIP service that runs on the internal network at 8080; you can see this by doing k get svc my-video-service. The ingress controller can connect an external user’s request by shuttling the data between IP addresses.

Not all of the ports need to be the same for the services exposed by an ingress resource.

1 Like

Hi -
I have a similar question from Lightening Labs - In the question below, it mentions " Here 30093 is the port used by the Ingress Controller"

Also in the solution - we do not specify this port number anywhere in the manifest file.

Please help in understanding this scenario…

That’s a port that configured on the ingress controller (IC) itself, and not in the ingress resource. If you look in the ingress-nginx namespace in this lab, you’ll find a NodePort service that the IC uses; that service is where the 30093 port is configured.

1 Like

Dear Rob
I have a followup question. In the image below, when I get ‘svc’ ingress-nginx-controller.
I see ports as 80:30080 - can you please help me understand what port 80 is and what 30080 is ?

The service is what’s called a “NodePort” service. The basic, default service in Kubernetes is a ClusterIP service – it creates a single IP that routes requests to that service IP to a group of pods; in our example, the service IP uses the port of 80. You can think of a NodePort service as one that makes it possible to use the IP of any node in the cluster, and it will forward the request on the nodePort (in our case, 30080) to SERVICE_IP:80, and then on to the pod group for handling.

1 Like

Can I visualize it like this ?
image

Thanks

You can, reasonably. The one thing missing is the link between the nodePort and the clusterIP address of the service. That missing link are firewalling rules created on the node by kube-proxy.