<p>In docker we can use -p flag to map container port to whatever port required. But in kubernetes if we use use NodePort then we will get ports of host which range start from 30000. So is there a way to map to a specific port?</p>

sandeep P
<p>You can use the <code>nodePort</code> field in the service definition to specify the port for the nodeport:</p>

<p><a href="https://kubernetes.io/docs/concepts/services-networking/service/#nodeport" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/#nodeport</a></p>

<p>However, a nodePort will allocate that port on all nodes in the cluster.</p>

<p>You can also specify a <code>hostPort</code> in the pod container spec itself, though it is not recommended:</p>

<pre><code>ports:
        - name: http
          containerPort: 80
          hostPort: 80 
</code></pre>
