I’ve been kicking around the idea of running a server for games and chat woth some of my friends, but worry about everyone getting cut off when there’s a disruption.
I’ve started looking into kubernetes out of curiosity, and it seems like we could potentially set up a cluster with master nodes at 3+ locations to hose whatever game server or chat server that we want with 100% uptime, solving my concerns.
Am I misunderstanding the kubernetes documentation, and this is just a terrible idea? Or am I on the right track?
I’d rent one (small) VPS for $10 a month and split the bill. As far as I know that’s how most people do it. It’s going to have >99.6% uptime, a fast datacenter internet connection at some central location and runs on enterprise hardware… The Kubernetes approach adds a lot of complexity, you’ll have your games disconnect anyway once it fails over as you can’t migrate the IP addresses. And there will be some additional traffic between the locations to keep everything in sync. And 4x chance of some of the hardware failing and someone needs to fix it. Unless I’m mistaken about how Kubernetes works.
I’m pretty sure half the point of kubernetes is to have the server automatically reroute traffic when one node goes down
That would be a load balancer but is not integral to the working of kubernetes. I wouldn’t consider kubernetes unless you have a need for autoscaling. It’s a lot of overhead for such a limited use case.
You can front any three un-clustered nodes with a load balancer to the same effect
Good to hear. Are there specific example you could point me to? I’d like to learn more
https://www.cloudflare.com/learning/performance/what-is-load-balancing/
https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/
I would start here. Most off the shelf proxies can do it. Once set up you’ll just have your friends connect to the load balancer either via IP or dns hostname. For anything behind a residential connection I would recommend either tunneling out or setting up ddns (dynamic dns) as the IPs can change every few days. Take a look at load balancing strategies as well
For the game server you’ll probably want failover instead, which most proxies can also provide. This is because a load balancer could route everyone to different instances. I would set up save syncs between the three nodes so that if your primary instance becomes unhealthy you can simply reconnect to the same address and the proxy will route you to the secondary node. Obviously requires healthchecks. When the primary node becomes healthy again new connections will be initiated there.
Both of these introduce latency because you are adding a network hop though. You could also look into dns failover (direct to each node) to avoid this
But doesn’t that require some software-defined networking or a special network setup? I’m pretty sure with the average home internet connection, you’ll fail over to the replica at your friend’s home. But that has an entirely different IP address and the game client will not handle that gracefully. It’s going to disconnect. And you need to do some DNS as well to always point at the active server and forbid caching. In a datacenter or enterprise setting, sure. you’ll just reroute the traffic and nobody will notice.
We don’t want to pay for a VPS. We’ve been burned by that too often in the past were you go months paying for a minecraft server that noone is using after the first month
Fair enough. I mean I’d pay about 200€ a year in electricity to run 3 efficient computers. And my VPS is only 73€ and I never have to pay for replacement parts (SSDs, harddisks) which I had to replace at home. And then they have gigabit network, low latency, a proper IP address, it didn’t fail yet so their reliability >99.6% seems to be correct. And that’s all way better than what I have at home. So it’s a no-brainer to go for that. But your calculation might be different.
I mean ultimately there is no harm in trying. If you have 3 old computers laying around, you might as well try setting up a kubernetes cluster. I think it’s going to prove difficult to handle the IP addresses but I’m not an expert on high availability and gaming clients.