Created
November 16, 2021 08:13
-
-
Save inductor/8ef28f5884b097b3c77842b9b01b603d to your computer and use it in GitHub Desktop.
sakura-cloud-minecraft.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat <<EOF > values.yaml | |
resources: | |
requests: | |
memory: 8192Mi | |
cpu: 800m | |
minecraftServer: | |
eula: "TRUE" | |
version: "1.17.1" | |
memory: "8192M" | |
type: "SPIGOT" | |
serviceType: "NodePort" | |
motd: "Welcome to the Minecraft life with K8s on Sakura no cloud" | |
extraPorts: | |
- name: map | |
containerPort: 8123 | |
protocol: TCP | |
service: | |
enabled: true | |
port: 8123 | |
type: NodePort | |
ingress: | |
enabled: false | |
extraEnv: | |
SPIGET_RESOURCES: 274 | |
persistence: | |
dataDir: | |
enabled: true | |
EOF | |
helm upgrade --install minecraft itzg/minecraft -f values.yaml | |
export NODE_PORT=$(kubectl get --namespace default \ | |
-o jsonpath="{.spec.ports[0].nodePort}" services minecraft-minecraft) | |
export NODE_MAP_PORT=$(kubectl get --namespace default \ | |
-o jsonpath="{.spec.ports[0].nodePort}" services minecraft-minecraft-map) | |
export NODE_IP=$(kubectl get nodes --namespace default \ | |
-o jsonpath="{.items[0].status.addresses[0].address}") | |
printf "\n\nYou'll need to expose this node through your security groups/firewall for it to be world-accessible. \n$NODE_IP:$NODE_PORT\ndynmap is available on the following endpoint \nhttp://$NODE_IP:$NODE_MAP_PORT/\n\n\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment