Readiness http-get with No Container Port Exposed

Hello -

I have a service with the following configs:

    Type:              ClusterIP
    Port:              <unset>  8080/TCP
    TargetPort:        8080/TCP

The container which is the endpoint has the following configs:

    Ports:          9080/TCP, 1099/TCP
    Host Ports:     0/TCP, 0/TCP
    State:          Running
      Started:      Mon, 25 Feb 2019 12:59:02 -0800
    Ready:          True
    Restart Count:  0
    Readiness:      http-get http://:8080/health delay=30s timeout=1s period=10s #success=1 #failure=3

If I try to access my service via http://my-service:8080 I get a 200. I expect this to not work because the container doesn’t have 8080 exposed. Can my service forward to ports that aren’t exposed?

exposing ports in Pods is optional - this is working as intended

Thanks @thockin

I am finding more and more documentation on how pod.spec.containers[].ports is purely for documentation. As long as the container is listening on the port(s) they will be available within the network. Thanks for putting me in the right direction.

Sort of, but its also possible to name them there and reference the same name in services. And some things like mesh will care