<p>I'm using Kubernetes on a centOS 7.</p>

<pre><code>Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.3", GitCommit:"b3cbbae08ec52a7fc73d334838e18d17e8512749", GitTreeState:"clean", BuildDate:"2019-11-13T11:23:11Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.3", GitCommit:"b3cbbae08ec52a7fc73d334838e18d17e8512749", GitTreeState:"clean", BuildDate:"2019-11-13T11:13:49Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

<p>I did deploy a Nginx pod on a "production" namespace by using the following <strong>prod_www_pod.yaml</strong>:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: www
  namespace: production
  labels:
    app: www
spec:
  containers:
  - name: nginx
    image: myrepo:5001/nginx
</code></pre>

<p>I've deployed a second one (<strong>prod_debug.yaml</strong>) in order to check if everything is running properly.</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: debug
  namespace: production
spec:
  containers:
  - name: debug
    image: myrepo:5001/debug:latest
    command:
    - "sleep"
    - "10000"
</code></pre>

<p>I can see both on the correct namespace, </p>

<pre><code>[plaurent@kubmaster deployment]$ kubectl get po
No resources found in default namespace.
[plaurent@kubmaster deployment]$ kubectl get po -n production
NAME    READY   STATUS    RESTARTS   AGE
debug   1/1     Running   0          94s
www     1/1     Running   0          3m57s
</code></pre>

<p>but when trying to curl www from debug, I have :</p>

<pre><code>[plaurent@kubmaster deployment]$ kubectl exec -it -n production debug -- sh
/ # curl www
Nothing there
/ # 
</code></pre>

<p>After a <code>kubectl delete po debug www -n production</code>, I tried to install the same except by removing the namespace specified on metadata.</p>

<pre><code>[plaurent@kubmaster deployment]$ kubectl get po
NAME    READY   STATUS    RESTARTS   AGE
debug   1/1     Running   0          10s
www     1/1     Running   0          18s
</code></pre>

<p>and when trying to contact www from debug, it is working well.</p>

<pre><code>[plaurent@kubmaster deployment]$ kubectl exec -it debug -- sh
/ # curl www
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Welcome to nginx!&lt;/title&gt;
&lt;style&gt;
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;Welcome to nginx!&lt;/h1&gt;
&lt;p&gt;If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.&lt;/p&gt;

&lt;p&gt;For online documentation and support please refer to
&lt;a href="http://nginx.org/"&gt;nginx.org&lt;/a&gt;.&lt;br/&gt;
Commercial support is available at
&lt;a href="http://nginx.com/"&gt;nginx.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Thank you for using nginx.&lt;/em&gt;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
/ # 
</code></pre>

<p>Can someone please point me in the right direction ?</p>

<p>Regards,</p>

<p>Pierre</p>

Tanc
<p>You can't reach a pod through dns, unless you have configured <code>hostname</code> and <code>subdomain</code> for it, and the way to reach it is not as you are doing.</p>

<p>Probably you have a service called <code>www</code> in the <code>default</code> namespace that is forwarding the request to the pod, but on your <code>production</code> namespace you don't have the service.</p>

<p>To confirm what I'm saying, run <code>kubectl get svc</code> in your <code>default</code> and <code>production</code> namespaces.</p>

<p>If I'm right, expose your pod, by <code>kubectl expose pod ...</code>, or create a service through a yaml file.</p>

<p>Now, note that create a pod is a bad idea. It is better to create e Deployment with 1 replica.</p>
