<p>There is already a port we are exposing at docker using <code>EXPOSE</code> in Dockerfile and again at Kubernetes service.yaml using <code>port</code> and <code>targetPort</code>; Those are understandable. But why there is a need to specify a port at Kubernetes deployment.yaml? Am I missing some concepts here?</p>

<p>Following the Kubernetes documentation <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/" rel="nofollow noreferrer">here</a>: </p>

<blockquote>
  <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 "0.0.0.0" address inside a container will be
  accessible from the network.</p>
</blockquote>

<p>So <code>ports</code> in <code>Deployment</code> is used for informational purpose. It is similar to <code>EXPOSE</code> in the Dockerfile. The main reason is helping people who maintain the deployment understand the configuration better.</p>
