Interview Prep/Kubernetes/Services, Networking, Ingress & Gateway API

What is the difference between `port`, `targetPort` and `nodePort`?

BeginnerConceptServices, Networking, Ingress & Gateway API
Answer

port is the port the Service listens on; targetPort is the container port traffic is forwarded to (number or named port); nodePort is the port opened on each node for NodePort/LoadBalancer Services. Mixing up targetPort with the app's real port is the classic cause of "connection refused".

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Services, Networking, Ingress & Gateway API