<p>I have a custom Kubernetes Cluster (deployed using <a href="https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/" rel="nofollow noreferrer">kubeadm</a>) running on Virtual Machines from an IAAS Provider. The Kubernetes Nodes have <em>no Internet facing IP Adresses</em> (except for the Master Node, which I also use for Ingress).</p>

<p>I'm now trying to join a Machine to this Cluster that is not hosted by my main IAAS provider. I want to do this because I need specialized computing resources for my application that are not offered by the IAAS.</p>

<p><strong>What is the best way to do this?</strong></p>

<hr>

<p>Here's what I've tried already:</p>

<ul>
<li><em>Run the Cluster on Internet facing IP Adresses</em></li>
</ul>

<p>I have no trouble joining the Node when I tell <code>kube-apiserver</code> on the Master Node to listen on <code>0.0.0.0</code> and use public IP Adresses for every Node. However, this approach is non-ideal from a security perspective and also leads to higher cost because public IP Adresses have to be leased for Nodes that normally don't need them.</p>

<ul>
<li><em>Create a Tunnel to the Master Node using <a href="https://github.com/apenwarr/sshuttle" rel="nofollow noreferrer">sshuttle</a></em></li>
</ul>

<p>I've had moderate success by creating a tunnel from the external Machine to the Kubernetes Master Node using sshuttle, which is configured on my external Machine to route <code>10.0.0.0/8</code> through the tunnel. This works in principle, but it seems way too hacky and is also a bit unstable (sometimes the external machine can't get a route to the other nodes, I have yet to investigate this problem further).</p>

<hr>

<p>Here are some ideas that could work, but I haven't tried yet because I don't favor these approaches:</p>

<ul>
<li><em>Use a proper VPN</em></li>
</ul>

<p>I could try to use a proper VPN tunnel to connect the Machine. I don't favor this solution because it would add a (admittedly quite small) overhead to the Cluster.</p>

<ul>
<li><em>Use a cluster federation</em></li>
</ul>

<p>It looks like <a href="https://kubernetes.io/docs/tasks/federation/set-up-cluster-federation-kubefed/" rel="nofollow noreferrer">kubefed</a> was made specifically for this purpose. However, I think this is overkill in my case: I'm only trying to join a single external Machine to the Cluster. Using Kubefed would add a <em>ton</em> of overhead (Federation Control Plane on my Main Cluster + Single Host Kubernetes Deployment on the external machine).</p>

<hr>

<p>I couldn't think about any better solution than a VPN here. Especially since you have only one isolated node, it should be relatively easy to make the handshake happen between this node and your master.</p>

<p>Routing the traffic from "internal" nodes to this isolated node is also trivial. Because all nodes already use the master as their default gateway, modifying the route table on the master is enough to forward the traffic from internal nodes to the isolated node through the tunnel.</p>

<p>You have to be careful with the configuration of your container network though. Depending on the solution you use to deploy it, you may have to assign a different subnet to the Docker bridge on the other side of the VPN.</p>
