<p>Recently i started building my very own kubernetes cluster using a few Raspberry pi's.</p>

<p>I have gotten to the point where i have a cluster up and running! </p>

<p>Some background info on how i setup the cluster, i used <a href="https://medium.com/nycdev/k8s-on-pi-9cc14843d43" rel="nofollow noreferrer">this guide</a></p>

<p>But now, when i want to deploy and expose an application i encounter some issues...</p>

<p>Following the kubernetes tutorials i have made an deployment of nginx, this is running fine. when i do a port-forward i can see the default nginx page on my localhost.</p>

<p>Now the tricky part, creating an service and routing the traffic from the internet through an ingress to the service.</p>

<p>i have executed the following command's</p>

<pre><code>kubectl expose deployment/nginx --type="NodePort" --port 80
kubectl expose deployment/nginx --type="Loadbalancer" --port 80
</code></pre>

<p>And these result in the following.</p>

<pre><code>NAME         TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)          AGE
kubernetes   ClusterIP   10.96.0.1     &lt;none&gt;        443/TCP          25h
nginx        NodePort    10.103.77.5   &lt;none&gt;        80:30106/TCP   7m50s
</code></pre>

<pre><code>NAME         TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP      10.96.0.1        &lt;none&gt;        443/TCP        25h
nginx        LoadBalancer   10.107.233.191   &lt;pending&gt;     80:31332/TCP   4s
</code></pre>

<p>The external ip address never shows, which makes it quite impossible for me to access the application from outside of the cluster by doing <code>curl some-ip:80</code> which in the end is the whole reason for me to setup this cluster.</p>

<p>If any of you have some clear guides or advice i can work with it would be really appreciated!</p>

<p>Note: 
I have read things about LoadBalancer, this is supposed to be provided by the cloud host. since i run on RPI i don't think this will work for me. but i believe NodePort should be just fine to route with an ingress.</p>

<p>Also i am aware of the fact that i should have an ingress-controller of some sort for ingress to work.</p>

<h1>Edit</h1>

<p>So i have the following now for the nodeport - 30168</p>

<pre><code>$ kubectl get svc
NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP   10.96.0.1       &lt;none&gt;        443/TCP        26h
nginx        NodePort    10.96.125.112   &lt;none&gt;        80:30168/TCP   6m20s
</code></pre>

<p>and for the ip address i have either <code>192.168.178.102</code> or <code>10.44.0.1</code> </p>

<pre><code>$ kubectl describe pod nginx-688b66fb9c-jtc98
Node:               k8s-worker-2/192.168.178.102
IP:                 10.44.0.1
</code></pre>

<p>But when i enter either of these ip addresses in the browser with the nodeport i still don't see the nginx page. am i doing something wrong?</p>

<p>Any of your worker nodes' IP address will work for a <code>NodePort</code> (or <code>LoadBalancer</code>) service.  From <a href="https://kubernetes.io/docs/concepts/services-networking/service/#nodeport" rel="nofollow noreferrer">the description of <code>NodePort</code> services</a> :</p>

<blockquote>
  <p>If you set the <code>type</code> field to <code>NodePort</code>, the Kubernetes control plane allocates a port from a range specified by <code>--service-node-port-range</code> flag (default: 30000-32767). Each node proxies that port (the same port number on every Node) into your Service.</p>
</blockquote>

<p>If you don't know those IP addresses <code>kubectl get nodes</code> can tell you; if you're planning on calling them routinely then setting up a load balancer in front of the cluster or configuring DNS (or both!) can be helpful.</p>

<p>In your example, say some node has the IP address 10.20.30.40 (you log into the Raspberry PI directly and run <code>ifconfig</code> and that's the host's address); you can reach the nginx from the second example at <code>http://10.20.30.40:31332</code>.</p>

<p>The <code>EXTERNAL-IP</code> field will never fill in for a <code>NodePort</code> service, or when you're not in a cloud environment that can provide an external load balancer for you.  That doesn't affect this case, for either of these service types you can still call the port on the node directly.</p>
