If I have a Kubernetes pod exposing port 8000, with an image running inside of the pod that is NOT in any way configured to connect to the pod's port 8000, will a connection to the pod's port 8000 still succeed? I'm trying to debug a scenario where Prometheus (a metrics collection tool) can communicate with my K8s pod on port 8000, but isn't receiving any metrics from the container (maybe because the container isn't mapped to the pod's port 8000).
Thanks!
When creating your image from a Dockerfile, use the EXPOSE command to expose a container port (documented here). From there, any incoming message to that host port will be forwarded into the container.