Run Kubernetes locally and connect to remote Docker server

11/16/2020

I want to run my docker containers on a remote server, because my machine isn't powerful enough.

I have setup a Hetzner server with docker-machine and have successfully switched to that docker server. Docker commands are now executed on my Hetzner machine.

I'd like to expand this setup to be able to run Kubernetes on this remote docker server.

Is that possible? Do I need to install Kubernetes on the VM running on Hetzner or can I run a local Kubernetes instance that simply uses the remote server?

I'd like my setup to be as close as possible to a local installation.

-- enyo
docker
docker-machine
kubernetes

2 Answers

11/19/2020

Kubernetes requires a control-plane (at least one server) and agent 'machines' (at least one). For a full installation it also requires an etcd database. For a minimum production configuration you'll need at least 9 separate servers.

Having said that, you can just run Rancher's K3D on the remote machine, which like minikube and Kind (and others), is a kubernetes installation that runs in docker on a single machine. Personally, I think K3D is the best option, but opinions vary. Be aware though that the resources required to run kubernetes are quite high, and the server you rent should have sufficient power. For a simple learning type workload I'd recommend at least 2 cores and 8gb of ram.

There are many ways to configure this and access it from your local machine. You'll need to open ports on the remote control-plane to allow access from your local, but it sounds like you've already done that for docker so you should be able to do it for kubernetes. You'll also need to use kubectl, but it's best to run that in a docker container, rather than installing it locally.

-- Software Engineer
Source: StackOverflow

11/19/2020

The way I understand it, it's not as easy as that. Some Kubernetes worker must be installed on the remote machine in order for my local Kubernetes server to be able to use it.

The easiest solution for me will be to rent a complete Kubernetes cluster from Digital Ocean or Google and use that. It's more expensive, but it will be the least amount of effort to get it running.

Another solution would be to install a full Kubernetes setup (with Minikube for example) on the remote machine, and use it via SSH.

-- enyo
Source: StackOverflow