<p>I try to access to my deployment but can't reach NodePort net.</p>

<p>curl 10.99.12.214:30991</p>

<pre><code>curl: (7) Failed connect to 10.99.12.214:30991; Aucun chemin d'accès pour atteindre l'hôte cible
</code></pre>

<p>kubectl get ep</p>

<pre><code>NAME            ENDPOINTS                          AGE
dark-room-dep   172.17.0.10:8085,172.17.0.9:8085   19h
kubernetes      10.66.222.223:6443                 8d
</code></pre>

<p>kubectl get svc</p>

<pre><code>NAME            TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
dark-room-dep   NodePort    10.99.12.214   &lt;none&gt;        8085:30991/TCP   19h
kubernetes      ClusterIP   10.96.0.1      &lt;none&gt;        443/TCP          8d
</code></pre>

<p>kubectl cluster-info</p>

<pre><code>Kubernetes master is running at https://10.66.222.223:6443
Heapster is running at https://10.66.222.223:6443/api/v1/namespaces/kube-system/services/heapster/proxy
KubeDNS is running at https://10.66.222.223:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
monitoring-grafana is running at https://10.66.222.223:6443/api/v1/namespaces/kube-system/services/monitoring-grafana/proxy
monitoring-influxdb is running at https://10.66.222.223:6443/api/v1/namespaces/kube-system/services/monitoring-influxdb/proxy
</code></pre>

<p>kubectl get deployment</p>

<pre><code>NAME            DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
dark-room-dep   2         2         2            2           20h
</code></pre>

<p>kubectl get pods --all-namespaces</p>

<pre><code>NAMESPACE     NAME                                            READY     STATUS    RESTARTS   AGE
default       dark-room-dep-577bf64bb8-9n5p7                  1/1       Running   0          20h
default       dark-room-dep-577bf64bb8-jmppg                  1/1       Running   0          20h
kube-system   etcd-localhost.localdomain                      1/1       Running   6          8d
kube-system   heapster-69b5d4974d-qvtrj                       1/1       Running   0          1d
kube-system   kube-apiserver-localhost.localdomain            1/1       Running   5          8d
kube-system   kube-controller-manager-localhost.localdomain   1/1       Running   4          8d
kube-system   kube-dns-86f4d74b45-njzj9                       3/3       Running   0          1d
kube-system   kube-flannel-ds-h9c2m                           1/1       Running   3          6d
kube-system   kube-flannel-ds-tcbd7                           1/1       Running   5          8d
kube-system   kube-proxy-7v6mf                                1/1       Running   3          6d
kube-system   kube-proxy-hwbwl                                1/1       Running   4          8d
kube-system   kube-scheduler-localhost.localdomain            1/1       Running   6          8d
kube-system   kubernetes-dashboard-7d5dcdb6d9-q42q5           1/1       Running   0          1d
kube-system   monitoring-grafana-69df66f668-zf2kc             1/1       Running   0          1d
kube-system   monitoring-influxdb-78d4c6f5b6-nhdbx            1/1       Running   0          1d
</code></pre>

<p>route -n</p>

<pre><code>Table de routage IP du noyau
Destination     Passerelle      Genmask         Indic Metric Ref    Use Iface
0.0.0.0         10.66.222.1     0.0.0.0         UG    100    0        0 ens192
10.66.222.0     0.0.0.0         255.255.254.0   U     100    0        0 ens192
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.25.1.0      172.25.1.0      255.255.255.0   UG    0      0        0 flannel.1
</code></pre>

<p>kubectl get nodes --all-namespaces</p>

<pre><code>NAME                    STATUS    ROLES     AGE       VERSION
k8s-01                  Ready     &lt;none&gt;    6d        v1.10.2
localhost.localdomain   Ready     master    8d        v1.10.2
</code></pre>

<p>from k8s-master:
curl 10.66.222.223:30991</p>

<pre><code>curl: (7) Failed connect to 10.66.222.223:30991; Aucun chemin d'accès pour atteindre l'hôte cible 
</code></pre>

<p>from a lambda pc:
PS C:\Users\XXX> curl 10.66.222.223:30991</p>

<pre><code>curl : can not connect to distant host
at char Ligne:1 : 1
+ curl 10.66.222.223:30991
</code></pre>

<p>kubectl describe svc dark-room</p>

<pre><code>Name:                     dark-room-dep
Namespace:                default
Labels:                   app=dark-room
Annotations:              &lt;none&gt;
Selector:                 app=dark-room
Type:                     NodePort
IP:                       10.99.12.214
Port:                     &lt;unset&gt;  8085/TCP
TargetPort:               8085/TCP
NodePort:                 &lt;unset&gt;  30991/TCP
Endpoints:                172.17.0.10:8085,172.17.0.9:8085
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   &lt;none&gt;
</code></pre>

<p>cat dark-svc.yaml</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: dark-room
  namespace: default
  labels:
    run: dark-room
    app: dark-room-svc
spec:
  externalIPs:
  - 10.66.222.223
  type: ClusterIP
  ports:
  - name: http
    port: 8085
    nodePort: 8086
    targetPort: http
    protocol: TCP
  selector:
    run: dark-room
    app: dark-room
</code></pre>

zonko
<p><strong>NodePort</strong> will bind the external port to node IP.</p>

<p>Try</p>

<pre><code>curl &lt;node external IP&gt;:&lt;external port&gt;
curl 10.66.222.223:30991
</code></pre>

<p>or</p>

<pre><code>curl &lt;service internal IP&gt;:&lt;internal port&gt;
curl 10.99.12.214:8085
</code></pre>
