From 192e2e869fd2726adcb409677679be925b67837a Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Mon, 13 May 2024 14:22:36 +0200 Subject: [PATCH] minecraft --- apps/minecraft/README.md | 7 ++++ apps/minecraft/deployment.yaml | 56 +++++++++++++++++++++++++++++++ apps/minecraft/kustomization.yaml | 15 +++++++++ apps/minecraft/namespace.yaml | 4 +++ apps/minecraft/pvc.yaml | 11 ++++++ apps/minecraft/service.yaml | 12 +++++++ 6 files changed, 105 insertions(+) create mode 100644 apps/minecraft/README.md create mode 100644 apps/minecraft/deployment.yaml create mode 100644 apps/minecraft/kustomization.yaml create mode 100644 apps/minecraft/namespace.yaml create mode 100644 apps/minecraft/pvc.yaml create mode 100644 apps/minecraft/service.yaml diff --git a/apps/minecraft/README.md b/apps/minecraft/README.md new file mode 100644 index 0000000..52ec321 --- /dev/null +++ b/apps/minecraft/README.md @@ -0,0 +1,7 @@ +## Sending a command +``` +kubectl exec -it -n minecraft deploy/minecraft-server -- /bin/bash +mc-send-to-console /help +# or directly +kubectl exec -it -n minecraft deploy/minecraft-server -- mc-send-to-console /help +``` diff --git a/apps/minecraft/deployment.yaml b/apps/minecraft/deployment.yaml new file mode 100644 index 0000000..ff69148 --- /dev/null +++ b/apps/minecraft/deployment.yaml @@ -0,0 +1,56 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: minecraft-server +spec: + selector: + matchLabels: + app: minecraft-server + template: + metadata: + labels: + app: minecraft-server + spec: + containers: + - name: minecraft-server + image: minecraft + resources: + limits: + memory: "4000Mi" + cpu: "2500m" + requests: + memory: "1000Mi" + cpu: "500m" + ports: + - containerPort: 25565 + env: + - name: EULA + value: "TRUE" + - name: MODPACK + value: "https://www.curseforge.com/api/v1/mods/711537/files/5076228/download" + - name: VERSION + value: "1.18.2" + # - name: VERSION + # value: "1.16.5" + # - name: MODPACK + # value: "https://mediafilez.forgecdn.net/files/3602/5/VaultHunters-OfficialModpack-1.12.1-Server.zip" + - name: INIT_MEMORY + value: "1G" + - name: MAX_MEMORY + value: "3G" + - name: MOTD + value: "VaultHunters baby!" + - name: ENABLE_RCON + value: "false" + - name: CREATE_CONSOLE_IN_PIPE + value: "true" + - name: ONLINE_MODE + value: "true" + volumeMounts: + - name: minecraft-data + mountPath: /data + + volumes: + - name: minecraft-data + persistentVolumeClaim: + claimName: minecraft-data diff --git a/apps/minecraft/kustomization.yaml b/apps/minecraft/kustomization.yaml new file mode 100644 index 0000000..124e1d0 --- /dev/null +++ b/apps/minecraft/kustomization.yaml @@ -0,0 +1,15 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +namespace: minecraft + +resources: + - namespace.yaml + - pvc.yaml + - deployment.yaml + - service.yaml + +images: + - name: minecraft + newName: itzg/minecraft-server + newTag: java21 diff --git a/apps/minecraft/namespace.yaml b/apps/minecraft/namespace.yaml new file mode 100644 index 0000000..0a074bd --- /dev/null +++ b/apps/minecraft/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: placeholder diff --git a/apps/minecraft/pvc.yaml b/apps/minecraft/pvc.yaml new file mode 100644 index 0000000..c30def1 --- /dev/null +++ b/apps/minecraft/pvc.yaml @@ -0,0 +1,11 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: minecraft-data +spec: + storageClassName: "nfs-client" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi diff --git a/apps/minecraft/service.yaml b/apps/minecraft/service.yaml new file mode 100644 index 0000000..bf230d6 --- /dev/null +++ b/apps/minecraft/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: minecraft-server +spec: + selector: + app: minecraft-server + ports: + - port: 25565 + targetPort: 25565 + type: LoadBalancer + loadBalancerIP: 192.168.3.4