<p>I used the kubectl with yaml files to create target pod, and found the process in the pod is listening target port as expected.</p>
<p>To my surprise, the Port is not seen in the outputs of <code>netstat -tunlp</code> or <code>netstat -alp</code> or <code>netstat -an</code> from host machine. But it works if I try telnet localhost targetPort!!!</p>
<p>Why this happens?? Can anybody explain this?</p>

<p>This is because of <code>docker</code>. By default docker does not add container network namespaces to the linux runtime data (/var/run mounted as a tmpfs from /run) which is what you see when you run the ip <code>netns</code> command.</p>
<p>To view the network namespaces you need to use <code>nsenter</code>.</p>
<ol>
<li>Get the container id.</li>
</ol>
<pre><code>docker ps
</code></pre>
<ol start="2">
<li>Get the container process id.</li>
</ol>
<pre><code>docker inspect --format '{{ .State.Pid }}' &lt;&lt;container-id&gt;&gt;
</code></pre>
<ol start="3">
<li>Now use the nsenter to display the pods network spaces. Advantage of using <code>nsenter</code> over <code>docker exec</code> is that nsenter will enable you to execute all tools or commands available on the node inside the pod where as <code>docker exec</code> will allow only limited or restricted commands.</li>
</ol>
<pre><code>nsenter -t &lt;&lt;container pid&gt;&gt; -n netstat -tunlp 

</code></pre>
