Question Mismatch

test23

mismatch port

image

What’s the mismatch? In a service, port and targetPort are two different things:

  • port refers to the port to use when accessing the service. So when you access the service, you access it (from the same namespace) as service-3421-svcn:8080.
  • targetPort is the containerPort of the target container in the pod the service links to. Which is 80 in this case.