<p>I have <code>Pod</code> and <code>Service</code> <code>ymal</code> files in my system. I want to run these two using <code>kubectl create -f &lt;file&gt;</code> and connect from outside browser to test connectivity.Here what I have followed.</p>

<p>My Pod :</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: client-nginx
  labels:
    component: web
spec:
  containers:
    - name: client
      image: nginx 
      ports:
        - containerPort: 3000
</code></pre>

<p>My Services file :</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
    name: client-nginx-port
spec:
  type: NodePort
  ports:
    - port: 3050
      targetPort: 3000
      nodePort: 31616
  selector:
    component: web
</code></pre>

<p>I used <code>kubectl create -f my_pod.yaml</code> and then <code>kubectl get pods</code> shows my pod <code>client-nginx</code></p>

<p>And then <code>kubectl create -f my_service.yaml</code>, No errors here and then shows all the services.</p>

<p>When I try to curl to service, it gives </p>

<blockquote>
  <p>curl: (7) Failed to connect to 192.168.0.10 port 31616: Connection refused.</p>
</blockquote>

<p><code>kubectl get deployments</code> doesnt show my pod. Do I have to deploy it? I am a bit confused. If I use instructions <a href="https://www.linode.com/docs/applications/containers/kubernetes/how-to-deploy-nginx-on-a-kubernetes-cluster/" rel="nofollow noreferrer">given here</a>, <code>I can deploy</code>nginx<code>successfully and access from outside browsers.</code></p>

<p>I used instructions <a href="http://containertutorials.com/get_started_kubernetes/k8s_example.html" rel="nofollow noreferrer">given here</a> to test this.</p>

<p>Try with this service:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
    name: client-nginx-port
spec:
  type: NodePort
  ports:
    - port: 3050
      targetPort: 80
      nodePort: 31616
  selector:
    component: web
</code></pre>
