In Kubernetes, kubectl internal port commands can save you time, reduce errors, and help you debug faster—if you know exactly how to use them. Most people only scratch the surface, but understanding how to work with service ports, target ports, and container ports lets you control traffic flow inside your cluster with precision.
When you define a Service in Kubernetes, the port is the entry point other Pods use to talk to it. The targetPort is the port on the container that actually receives the traffic. The nodePort—if used—opens it up outside the cluster. The internal port is what binds them together inside the cluster, invisible to the public but essential for your applications to talk to each other.
To see the internal ports at a glance, this command is your friend:
kubectl get svc
It lists the cluster IP, the port mapping, and lets you check that what you deployed matches what you expect.
For deeper inspection, run: