<p>I have deployed a docker application onto my docker hub <a href="https://hub.docker.com/r/leexha/nodejsapp/" rel="nofollow noreferrer">https://hub.docker.com/r/leexha/nodejsapp/</a>. </p>

<p>I verfiied this by doing a docker pull and did a <code>docker run docker run -p 8000:3000 index.docker.io/leexha/nodejsapp:latest</code></p>

<p>I am trying to deploy this into kubernetes. This is my <code>deploy.yml</code> file:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: secondapp
spec:
  replicas: 3
  template:
    metadata:
      labels:
        app: webapp
    spec:
      containers:
      - name: webapp
        image: index.docker.io/leexha/nodejsapp
        ports:
        - containerPort: 3000
        resources:
          requests: 
            memory: 500Mi
            cpu: 0.5
          limits:
            memory: 500Mi
            cpu: 0.5
        imagePullPolicy: Always
</code></pre>

<p>I then exposed the deployment as a service:</p>

<pre><code>C:\Users\adrlee\Desktop\oracle\Web_projects&gt;kubectl get nodes
NAME              STATUS     ROLES     AGE       VERSION
xxxxxxxxxxx   Ready      node      1d        v1.8.11
yyyyyyyyyyy    NotReady   node      1d        v1.8.11
zzzzzzzzzzz    Ready      node      1d        v1.8.11

C:\Users\adrlee\Desktop\oracle\Web_projects&gt;kubectl get deployments
NAME       DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
firstapp   3         3         3            3           6m

C:\Users\adrlee\Desktop\oracle\Web_projects&gt;kubectl expose deployment/firstapp --type="NodePort" --port 3000
service "firstapp" exposed

C:\Users\adrlee\Desktop\oracle\Web_projects&gt;kubectl get services
NAME         TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)          AGE
firstapp     NodePort    10.96.156.3   &lt;none&gt;        3000:31872/TCP   10s
kubernetes   ClusterIP   10.96.0.1     &lt;none&gt;        443/TCP          1d
</code></pre>

<p>It seems everything is in order however when I try to access my application on the cluster (:3000) it can't be access. </p>

<p>So I tried to do a bit of debugging. </p>

<p>I did: </p>

<pre><code>export POD_NAME=$(kubectl get pods -o go-template --template '{{range .items}}                                       {{.metadata.name}}{{"\n"}}{{end}}')
</code></pre>

<p>and I did a curl</p>

<pre><code>curl http://localhost:8001/api/v1/namespaces/default/pods/$POD_NAME/proxy/
</code></pre>

<p>I notice this response:</p>

<pre><code>}
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0cu                                       rl: (6) Could not resolve host: firstapp-f85d8f76c-bqsst
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0cu                                       rl: (6) Could not resolve host: firstapp-f85d8f76c-txlng
</code></pre>

<p>Little lost what to do now. Would appreciate any help?</p>

Adam
<p>If you set the type field to NodePort, the Kubernetes master will allocate a port from a range specified by <code>--service-node-port-range</code> flag (default: 30000-32767) in <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/" rel="nofollow noreferrer">kube-apiserver</a></p>

<p>Try with a port in this default range or check the kube-apiserver service on your master for the specific custom range.</p>
