gilesknap / k3s-minecraft

Minecraft servers managed in a lightweight Kubernetes cluster
Apache License 2.0
71 stars 8 forks source link

k8s-mc script help #3

Open phreekbird opened 2 years ago

phreekbird commented 2 years ago
ubuntu at omega in ~/Documents/k3s-minecraft-server on main
$ k8s-mclist
NAME   MODE   VERSION   SERVER   RUNNING
error: array index out of bounds: index 22, length 7

get the above error when i try to list my running mc servers. have no idea how to exec into them and run commands without doing this first as i dunno what the names are.

gilesknap commented 2 years ago

It looks like something is up with your k8s installation since k8s-mclist just calls a basic kubectl command.

To find out what pods you have running:

kubectl get pods -n minecraft

Or you could try

kubectl get pods --all-namespaces

If you don't see anything in the first command.

phreekbird commented 2 years ago

huh those commands work find, i wonder if its cause im using k3s?

gilesknap commented 2 years ago

So k8s-mclist only does this

kubectl -n minecraft get deploy -o $format

where format is set using

format=custom-columns=\
NAME:metadata.labels.release\
,MODE:spec.template.spec.containers[0].env[22].value\
,VERSION:spec.template.spec.containers[0].env[2].value\
,SERVER:'spec.template.spec.nodeSelector.kubernetes\.io/hostname'\
,RUNNING:status.availableReplicas

I can only assume that one of the columns in format is missing from your setup for some reason - its not a great errror!