<p>What is the use of specifying containerPort in the kubernetes POD definition ?
Does it provide any extra benefit if we specify the container port in the yaml definition file ?</p>
<p>I observed that i can still access the port inside the container even if i omit it in POD yaml definition file.</p>

<p>It's informational.</p>
<p>From <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/" rel="noreferrer">Kubernetes API Spec</a></p>
<p>List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default &quot;0.0.0.0&quot; address inside a container will be accessible from the network. Cannot be updated.</p>
