Closed geerlingguy closed 4 years ago
Maybe see if the Helm chart works? https://github.com/helm/charts/tree/master/stable/minecraft
The minecraft chart sets up an external LoadBalancer, and Rancher sets it up on a NodePort on one of the servers; see https://rancher.com/docs/k3s/latest/en/networking/#service-load-balancer
In my case:
# kubectl get svc --namespace minecraft
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
minecraft-minecraft LoadBalancer 10.43.255.5 10.0.100.99 25565:31123/TCP 78m
I haven't played minecraft in a few years. I'm going to see if my license is still valid and see if I can join that server on 10.0.100.99:31123
.
Apparently I bought it on 15 February, 2012 — dusted off my old account and am opening it up now!
On my Mac (Java Minecraft client):
10.0.100.99:31123
).Note: This is currently not working. Trying to figure out why.
nmap
not showing that port as open:
$ nmap -p- 10.0.100.99
Starting Nmap 7.80 ( https://nmap.org ) at 2020-05-24 23:08 CDT
Nmap scan report for worker-02 (10.0.100.99)
Host is up (0.0037s latency).
Not shown: 65524 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp open https
5355/tcp open llmnr
9100/tcp open jetdirect
9243/tcp open unknown
10250/tcp open unknown
30442/tcp open unknown
31141/tcp open unknown
31583/tcp open unknown
31853/tcp open unknown
Ah, crashloopbackoff on the minecraft pod... that would explain no response and port not being open:
# kubectl logs -n minecraft minecraft-minecraft-688bb88bcd-nczfv
chmod: changing permissions of '/data': Operation not permitted
[init] Running as uid=1000 gid=1000 with /data as 'drwxrwxrwx 5 0 0 4096 May 25 03:09 /data'
[init] Resolved version given 1.14.4 into 1.14.4
[init] Resolving type given VANILLA
[init] server.properties already created, skipping
[init] log4j2.xml already created, skipping
[init] Checking for JSON files.
[init] Setting initial memory to 512M and max to 512M
[init] Starting the Minecraft server...
[04:17:38] [main/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[04:17:38] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[04:17:38] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[04:17:38] [main/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[04:17:38] [main/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[04:17:38] [Server thread/INFO]: Starting minecraft server version 1.14.4
[04:17:38] [Server thread/WARN]: To start the server with more ram, launch it as "java -Xmx1024M -Xms1024M -jar minecraft_server.jar"
[04:17:38] [Server thread/INFO]: Loading properties
[04:17:38] [Server thread/INFO]: Default game type: SURVIVAL
[04:17:38] [Server thread/INFO]: Generating keypair
[04:17:42] [Server thread/INFO]: Starting Minecraft server on *:25565
[04:17:42] [Server thread/INFO]: Using default channel type
[04:17:43] [Server thread/INFO]: Preparing level "world"
[04:17:43] [Server thread/INFO]: Found new data pack vanilla, loading it automatically
[04:17:43] [Server thread/INFO]: Reloading ResourceManager: Default
[04:18:00] [Server thread/INFO]: Loaded 6 recipes
[04:18:03] [Server thread/INFO]: Loaded 811 advancements
2020/05/25 04:18:30 Stopping with rcon-cli
2020-05-25T04:18:30.971Z ERROR mc-server-runner ERROR Failed to stop using rcon-cli {"error": "exit status 1"}
2020-05-25T04:18:30.972Z INFO mc-server-runner Sending 'stop' to Minecraft server...
2020-05-25T04:18:30.972Z INFO mc-server-runner Waiting for completion...
Also see: https://github.com/helm/charts/issues/19850 (for using Ingress instead of a LoadBalancer service). Note that you can override the service type with --set minecraftServer.serviceType=NodePort
. And you could add a custom Ingress resource.
The frequent failures could be due to timeouts from liveness/readiness probes; see https://github.com/itzg/docker-minecraft-server/issues/405#issuecomment-546673231
Thanks all, the reason was in readiness/liveness probes. I've increased timeouts and everything works well now :)
It keeps getting to Running
, then back to CrashLoopBackOff
. So I think it's something with the liveness/readiness probes, I'll see if I can disable those.
I set the timeout for readiness/liveness to 15 minutes... and it looks like I'll have to keep increasing it; the process that generates the spawn area is slooooow on the Pi 3 (note that I think this chart deployed a pod onto one of the slower CM3 boards instead of the 3+):
[15:43:48] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:48] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:49] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:49] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:50] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:50] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:51] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:51] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:53] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:53] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:53] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:54] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:54] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:55] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:56] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:56] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[15:43:56] [Server-Worker-1/INFO]: Preparing spawn area: 1%
[15:43:56] [Server-Worker-1/INFO]: Preparing spawn area: 1%
[15:43:57] [Server-Worker-1/INFO]: Preparing spawn area: 1%
...
Minecraft block printer go brrrr
Drat! Finally got the thing running, and I get the following when I try to connect:
I got the connection via kubectl get service -n minecraft
—in my case, the LoadBalancer was placed on 10.0.100.99:31123
.
Interestingly, the logs are also a little alarming :P
[16:09:32] [Server thread/INFO]: Time elapsed: 432233 ms
[16:09:32] [Server thread/INFO]: Done (994.061s)! For help, type "help"
[16:09:32] [Server thread/INFO]: Starting remote control listener
[16:09:32] [RCON Listener #1/INFO]: RCON running on 0.0.0.0:25575
[16:09:34] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2417ms or 48 ticks behind
[16:10:06] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 16451ms or 329 ticks behind
[16:15:24] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 33175ms or 663 ticks behind
Changed some settings and ticks are better now:
[18:44:46] [RCON Listener #1/INFO]: RCON running on 0.0.0.0:25575
[18:44:48] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2029ms or 40 ticks behind
[18:45:15] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 11428ms or 228 ticks behind
[18:50:15] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 15140ms or 302 ticks behind
[18:55:17] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2054ms or 41 ticks behind
[19:00:19] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2067ms or 41 ticks behind
Relevant values:
values:
# These settings should help the server run better on underpowered Pis.
maxWorldSize: 5000
viewDistance: 6
It worked! Some delays here and there, but overall it worked out, and I'm pretty happy with it.
It looks like I hit the perfect time, too: https://github.com/itzg/docker-minecraft-server/issues/316