Kubernetes Deployment
Deploy the Lumo Minecraft server on Kubernetes for high availability and easy scaling.
Prerequisites
Section titled “Prerequisites”- Kubernetes cluster (1.19+)
kubectlconfigured- Persistent volume support (or dynamic provisioning)
- LoadBalancer support (for external access) or NodePort
Basic Deployment
Section titled “Basic Deployment”Namespace
Section titled “Namespace”Create a dedicated namespace:
apiVersion: v1kind: Namespacemetadata: name: minecraftApply:
kubectl apply -f namespace.yamlPersistent Volume Claims
Section titled “Persistent Volume Claims”Create PVCs for data and backups:
apiVersion: v1kind: PersistentVolumeClaimmetadata: name: minecraft-data namespace: minecraftspec: accessModes: - ReadWriteOnce resources: requests: storage: 10Gi---apiVersion: v1kind: PersistentVolumeClaimmetadata: name: minecraft-backups namespace: minecraftspec: accessModes: - ReadWriteOnce resources: requests: storage: 20GiDeployment
Section titled “Deployment”apiVersion: apps/v1kind: Deploymentmetadata: name: lumo-server namespace: minecraftspec: replicas: 1 # Minecraft servers must have exactly 1 replica strategy: type: Recreate # Important: Do not use RollingUpdate selector: matchLabels: app: lumo-server template: metadata: labels: app: lumo-server spec: containers: - name: minecraft image: ghcr.io/lucasilverentand/lumo-server:latest ports: - containerPort: 25565 name: minecraft protocol: TCP - containerPort: 8100 name: bluemap protocol: TCP - containerPort: 25575 name: rcon protocol: TCP - containerPort: 24454 name: voicechat protocol: UDP env: - name: EULA value: "true" - name: MEMORY value: "4G" - name: ENABLE_AUTOPAUSE value: "false" # Disable in Kubernetes (health checks conflict) - name: BACKUP_ENABLED value: "true" - name: RCON_PASSWORD valueFrom: secretKeyRef: name: minecraft-secrets key: rcon-password resources: requests: memory: "4Gi" cpu: "2000m" limits: memory: "6Gi" cpu: "4000m" volumeMounts: - name: data mountPath: /data - name: backups mountPath: /backups livenessProbe: tcpSocket: port: 25565 initialDelaySeconds: 300 periodSeconds: 30 readinessProbe: tcpSocket: port: 25565 initialDelaySeconds: 60 periodSeconds: 10 volumes: - name: data persistentVolumeClaim: claimName: minecraft-data - name: backups persistentVolumeClaim: claimName: minecraft-backupsService
Section titled “Service”Expose the server using LoadBalancer or NodePort:
LoadBalancer (Cloud Providers)
Section titled “LoadBalancer (Cloud Providers)”apiVersion: v1kind: Servicemetadata: name: lumo-server namespace: minecraftspec: type: LoadBalancer selector: app: lumo-server ports: - name: minecraft port: 25565 targetPort: 25565 protocol: TCP - name: bluemap port: 8100 targetPort: 8100 protocol: TCP - name: rcon port: 25575 targetPort: 25575 protocol: TCP - name: voicechat port: 24454 targetPort: 24454 protocol: UDPNodePort (Self-Hosted)
Section titled “NodePort (Self-Hosted)”apiVersion: v1kind: Servicemetadata: name: lumo-server namespace: minecraftspec: type: NodePort selector: app: lumo-server ports: - name: minecraft port: 25565 targetPort: 25565 nodePort: 30565 # Access on <node-ip>:30565 protocol: TCP - name: bluemap port: 8100 targetPort: 8100 nodePort: 30100 protocol: TCPSecrets
Section titled “Secrets”Store sensitive configuration:
kubectl create secret generic minecraft-secrets \ --from-literal=rcon-password='your-strong-password' \ -n minecraftConfiguration via ConfigMap
Section titled “Configuration via ConfigMap”For environment variables, use a ConfigMap:
apiVersion: v1kind: ConfigMapmetadata: name: minecraft-config namespace: minecraftdata: MEMORY: "4G" DIFFICULTY: "hard" MAX_PLAYERS: "20" MOTD: "Welcome to Lumo Server on Kubernetes!" OPS: "YourMinecraftUsername"Reference in deployment:
envFrom:- configMapRef: name: minecraft-configCloud Storage for Backups
Section titled “Cloud Storage for Backups”AWS S3
Section titled “AWS S3”Create secret with AWS credentials:
kubectl create secret generic aws-credentials \ --from-literal=AWS_ACCESS_KEY_ID='your-key' \ --from-literal=AWS_SECRET_ACCESS_KEY='your-secret' \ -n minecraftAdd to deployment env:
- name: S3_ENABLED value: "true"- name: S3_BUCKET value: "minecraft-backups"- name: AWS_DEFAULT_REGION value: "us-east-1"- name: AWS_ACCESS_KEY_ID valueFrom: secretKeyRef: name: aws-credentials key: AWS_ACCESS_KEY_ID- name: AWS_SECRET_ACCESS_KEY valueFrom: secretKeyRef: name: aws-credentials key: AWS_SECRET_ACCESS_KEYHelm Chart (Advanced)
Section titled “Helm Chart (Advanced)”For easier management, consider creating a Helm chart:
image: repository: ghcr.io/lucasilverentand/lumo-server tag: latest pullPolicy: Always
minecraft: eula: true memory: "4G" ops: "YourUsername" motd: "Lumo Server"
service: type: LoadBalancer ports: minecraft: 25565 bluemap: 8100 rcon: 25575
persistence: data: enabled: true size: 10Gi backups: enabled: true size: 20Gi
resources: requests: memory: 4Gi cpu: 2 limits: memory: 6Gi cpu: 4Monitoring
Section titled “Monitoring”Add Prometheus metrics exporter sidecar:
- name: minecraft-exporter image: joshi425/minecraft_exporter:latest ports: - containerPort: 9150 name: metrics env: - name: MC_RCON_ADDRESS value: "localhost:25575" - name: MC_RCON_PASSWORD valueFrom: secretKeyRef: name: minecraft-secrets key: rcon-passwordScaling Considerations
Section titled “Scaling Considerations”For multiple servers:
- Deploy separate instances with different names
- Use different namespaces or selectors
- Each needs its own PVC
Backup Strategy
Section titled “Backup Strategy”- Local PVC: Automated backups to
/backupsvolume - S3: Offsite backups for disaster recovery
- PVC Snapshots: Use your cluster’s volume snapshot feature
Example snapshot:
apiVersion: snapshot.storage.k8s.io/v1kind: VolumeSnapshotmetadata: name: minecraft-data-snapshot namespace: minecraftspec: source: persistentVolumeClaimName: minecraft-dataTroubleshooting
Section titled “Troubleshooting”Pod Stuck in Pending
Section titled “Pod Stuck in Pending”Check PVC binding:
kubectl get pvc -n minecraftkubectl describe pvc minecraft-data -n minecraftServer Not Accessible
Section titled “Server Not Accessible”Check service external IP:
kubectl get svc -n minecraftView pod logs:
kubectl logs -f deployment/lumo-server -n minecraftPerformance Issues
Section titled “Performance Issues”Increase resources in deployment:
resources: requests: memory: "6Gi" cpu: "3000m" limits: memory: "8Gi" cpu: "6000m"Complete Example
Section titled “Complete Example”Save all manifests in minecraft-k8s.yaml:
kubectl apply -f minecraft-k8s.yamlMonitor deployment:
kubectl get all -n minecraftkubectl logs -f deployment/lumo-server -n minecraftGet external IP:
kubectl get svc lumo-server -n minecraftConnect to the server using the EXTERNAL-IP shown in the service.
Next Steps
Section titled “Next Steps”- Environment Variables - Full configuration reference
- Automated Backups - Configure S3 backups
- Troubleshooting - Common issues