<p>Hi I am trying to do communication between a mongo database and nodejs application using kubernetes. everything is running fine . but I ma unable to access my api from outside environment. I am also not able to telnet the port.</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: node
  labels:
    app: node
    tier: backend
spec:
  type: NodePort
  ports:
    - port: 3000
      nodePort: 30005
  externalIPs:
    - 34.73.154.127 
  # # Replace with the IP of your minikube node / master node
  # selector:
  #   app: node 
  #   tier: backend  
</code></pre>

<p>this is my service yaml file </p>

<p>when i am checking the status of port using command<br>
<code>sudo lsof -i:30005</code><br>
I am able to see the results as below </p>

<pre><code>COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
kube-prox 2925 root    8u  IPv6  32281      0t0  TCP *:30005 (LISTEN)  
</code></pre>

<p>Now i should be able to telnet the port with ip like<br>
<code>telnet 34.73.154.127 30005</code>  but I am getting result as below.</p>

<pre><code>Trying 34.73.154.127...
telnet: Unable to connect to remote host: Connection refused  
</code></pre>

<p>If any of my friend is going to suggest that port is not open then please note that i have open all the port range from anywhere.</p>

<p>One more thing I want to let you know that I deployed a sample node application natively using npm on port 30006 and i am able to telnet on this port. So conclusion is that all the port range is open and working.</p>

<p>This is the describe command result of service<br>
<code>kubectl describe service/node</code>
result:</p>

<pre><code>Name:                     node
Namespace:                default
Labels:                   app=node
                          tier=backend
Annotations:              kubectl.kubernetes.io/last-applied-configuration:
                            {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"node","tier":"backend"},"name":"node","namespace":"defau...
Selector:                 &lt;none&gt;
Type:                     NodePort
IP:                       10.102.42.145
External IPs:             34.73.154.127
Port:                     &lt;unset&gt;  3000/TCP
TargetPort:               3000/TCP
NodePort:                 &lt;unset&gt;  30005/TCP
Endpoints:                &lt;none&gt;
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   &lt;none&gt;
</code></pre>

<p>Please let me know what is wrong with me ..</p>

<pre><code>ENVIRONMENT: 
cloud :google cloud platform
container :using docker and kubernetes
ubuntu 16.04 LTS
kubernetes 1.13.0
</code></pre>

Pankaj Cheema
<p>Hi I was doing a silly mistake .<br>
Just uncommented this in my service yaml file and it started working  </p>

<pre><code># # Replace with the IP of your minikube node / master node
  # selector:
  #   app: node 
  #   tier: backend  
</code></pre>
