<p>I am new to Kubernetes and have a basic question.  I installed the Canonical Distribution of Kubernetes on a bare metal Ubuntu "Localhost" setup with LXD.  </p>

<p>I am able to run a simple deployment/service for a NGINX cluster.  However, I am confused as to how I can actually expose it externally using my server hostip.</p>

<p>For instance:</p>

<pre><code>kubectl run my-nginx --image=nginx --replicas=3 --port=80
kubectl expose deployment my-nginx --type=NodePort
kubectl describe services my-nginx --&gt; Shows NodePort as 31198
</code></pre>

<p>I can successfully run a CURL to any of the Worker Nodes:</p>

<pre><code>curl 10.112.134.139:31198
curl 10.112.134.41:31198
</code></pre>

<p>However, my hostip is 192.168.X.Y.  How can I actually expose this so I can access using the HOSTIP?</p>

<p>From what you describe, it looks like, in your local environment, configured a "containerized cluster". Therefore, you can access the NodePort accessing these containerized worker nodes, but the host IP itself (as there is nothing configured in that local host, right?). </p>

<p>So, what you would need to do is to establish a way to forward traffic from the Host to the "containerized cluster", so the NodePort is accessible. </p>

<p>One way that comes to mind would be, in the machine you are trying to access from, to configure a route like this</p>

<p>10.112.134.0/24 - gateway 192.168.X.Y</p>

<pre><code>   sudo route add -net 10.112.134.0/24 gw 192.168.X.Y
</code></pre>

<p>Probably, you may need to check that the sysctl rule net.ip4.forward is enabled.</p>
