--- apiVersion: apps/v1 kind: StatefulSet metadata: name: minecraft-server namespace: minecraft spec: selector: matchLabels: app: minecraft-server template: metadata: labels: app: minecraft-server spec: # Prevent scheduling on Raspberry Pi due to high resource requirements (1Gi-4Gi memory, 1-2 CPU) nodeSelector: hardware: high-memory containers: - name: minecraft-server image: itzg/minecraft-server:latest # Or specific version if needed env: - name: EULA value: "TRUE" - name: MODE value: "survival" - name: INIT_MEMORY value: 1G - name: MAX_MEMORY value: 4G # - name: CF_SERVER_MOD # value: "/modpacks/your-modpack.zip" # - name: ALLOW_FLIGHT # value: "TRUE" # - name: USE_AIKAR_FLAGS # value: "TRUE" # - name: RCON_PASSWORD # value: "rcon-password" ports: - name: minecraft containerPort: 25565 # Expose port 25565 - name: minecraft-rcon containerPort: 25575 - name: metrics containerPort: 19565 resources: requests: cpu: 1 #4 # Adjust based on expected workload memory: "1Gi" #"12Gi" # Adjust based on expected workload limits: cpu: 2 #8 # Adjust based on expected workload memory: "4Gi" #"16Gi" # Adjust based on expected workload readinessProbe: exec: command: [ "/usr/local/bin/mc-monitor", "status", "--host", "localhost" ] # Give it i + p * f seconds to be ready, so 120 seconds initialDelaySeconds: 20 periodSeconds: 5 failureThreshold: 20 # Monitor ongoing liveness livenessProbe: exec: command: ["/usr/local/bin/mc-monitor", "status", "--host", "localhost"] initialDelaySeconds: 120 periodSeconds: 60 volumeMounts: - name: minecraft-data mountPath: /data volumes: - name: minecraft-data persistentVolumeClaim: claimName: minecraft-data