<p>TL;DR;</p>

<p>How do I connect to my kubernetes cluster from my host machine, through Hyper-V and into the Kubernetes Proxy (kube-proxy).</p>

<hr />

<p>So I have hyper-v setup with two Ubuntu 18.04.1 LTS Servers. Identical setup.</p>

<p>One is a master</p>

<pre><code>OS Image:                   Ubuntu 18.04.1 LTS
Operating System:           linux
Architecture:               amd64
Container Runtime Version:  docker://18.6.0
Kubelet Version:            v1.11.1
Kube-Proxy Version:         v1.11.1
</code></pre>

<p>The other a node:</p>

<pre><code>OS Image:                   Ubuntu 18.04.1 LTS
Operating System:           linux
Architecture:               amd64
Container Runtime Version:  docker://18.6.0
Kubelet Version:            v1.11.1
Kube-Proxy Version:         v1.11.1
</code></pre>

<p>It has these pods running by default:</p>

<pre><code>kube-system   coredns-78fcdf6894-6ld8l               1/1       Running   1          4h
kube-system   coredns-78fcdf6894-ncp79               1/1       Running   1          4h
kube-system   etcd-node1                             1/1       Running   1          4h
kube-system   kube-apiserver-node1                   1/1       Running   1          4h
kube-system   kube-controller-manager-node1          1/1       Running   1          4h
kube-system   kube-proxy-942xh                       1/1       Running   1          4h
kube-system   kube-proxy-k6jl4                       1/1       Running   1          4h
kube-system   kube-scheduler-node1                   1/1       Running   1          4h
kube-system   kubernetes-dashboard-6948bdb78-9fbv8   1/1       Running   0          25m
kube-system   weave-net-fzj8h                        2/2       Running   2          3h
kube-system   weave-net-s648g                        2/2       Running   3          3h
</code></pre>

<p>These two nodes are exposed to my LAN via two IP addresses:</p>

<pre><code>192.168.1.116
192.168.1.115
</code></pre>

<p>I've exposed my deployment:</p>

<p><code>service.yml</code>:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  type: NodePort # internal cluster management
  ports:
  - port: 80 # container port
    nodePort: 30001 # outside port
    protocol: TCP
    targetPort: http
  selector:
    app: my-api
    tier: backend
</code></pre>

<p>List out:</p>

<pre><code>$ kubectl get svc -o wide
my-service   NodePort    10.105.166.48   &lt;none&gt;        80:30001/TCP   50m       app=my-api,tier=backend
kubernetes   ClusterIP   10.96.0.1       &lt;none&gt;        443/TCP        4h        &lt;none&gt;
</code></pre>

<p>If I sit on my master node and curl the pod</p>

<pre><code>$ kubectl get pods -o wide
my-api-86db46fc95-2d6wf   1/1       Running   0          22m       10.32.0.7   node2
$ curl 10.32.0.7:80/api/health
{"success": true}
</code></pre>

<p>My api is clearly up in the pods.</p>

<p>When I query the service IP</p>

<pre><code>$ curl 10.105.166.48:80/api/health
</code></pre>

<p>OR</p>

<pre><code>$ curl 10.105.166.48:30001/api/health
</code></pre>

<p>It just timeouts</p>

<p>My network config for the master:</p>

<pre><code>eth0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
    inet 192.168.1.116  netmask 255.255.255.0  broadcast 192.168.1.255

weave: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1376
    inet 10.40.0.0  netmask 255.240.0.0  broadcast 10.47.255.255

docker0: flags=4099&lt;UP,BROADCAST,MULTICAST&gt;  mtu 1500
    inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
</code></pre>

<p>My iptables are just listing everything as <code>source anywhere</code> <code>destination anywhere</code> with loads of references to KUBE and DOCKER.</p>

<p>I've even tried to setup <a href="https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/#deploying-the-dashboard-ui" rel="nofollow noreferrer">dashboard</a> to no avail...</p>

<p>accessing the url:</p>

<pre><code>https://192.168.1.116:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
</code></pre>

<p>Doing <code>nslookup</code> reveals no host name:</p>

<pre><code>$ nslookup my-service
Server:         127.0.0.53
Address:        127.0.0.53#53

** server can't find eyemenu-api-service: SERVFAIL
</code></pre>

Callum Linington
<p>To hit the nodeport 30001, you need to use your node's ip.</p>

<p>curl nodeip:30001/api/health</p>

<p>Pods inside the cluster doesn't know about the node port 30001.</p>

<p>The nodePort will expose the port to all worker nodes of the kubernetes cluster, hence you can use  either:</p>

<p>curl node1:30001/api/health or 
curl node2:30001/api/health</p>
