c29150d0fb3cce586041c59c3790b26fa8455552
Minecraft Server - Biohazard Project Genesis
Questo progetto contiene i manifest Kubernetes per distribuire un server Minecraft con il modpack Biohazard Project Genesis (Fallout-themed).
Files
namespace.yaml- Crea il namespaceminecraftpvc.yaml- PersistentVolumeClaim per i dati del mondo (50GB)init-configmap.yaml- ConfigMap per gli script di inizializzazioneconfigmap.yaml- Configurazione del server (server.properties)statefulset.yaml- Deployment del server Minecraftservice.yaml- Servizio LoadBalancer per l'accesso esternoDockerfile- Immagine personalizzata con modpack installatoserver-start.sh- Script di avvio del servervalues.yaml- File values per Helm (opzionale)deploy.sh- Script di deployment automatico
Prerequisiti
- Kubernetes cluster con Longhorn storage (storageClassName:
longhorn-fast) - Docker per buildare l'immagine personalizzata
- kubectl configurato per accedere al cluster
Configurazione
Modpack Details
- Modpack ID: 1082278
- Nome: Biohazard Project Genesis
- Minecraft Version: 1.20.1
- Modloader: Forge
- File ID: da autenticare via API CurseForge
Resource Requirements
- CPU: 2 core (4 max)
- Memory: 8GB (4GB min, 8GB max)
- Storage: 50GB (longhorn-fast)
- Players: fino a 50
Deployment
Metodo 1: Manualmente
# Create namespace
kubectl apply -f namespace.yaml
# Create PVC
kubectl apply -f pvc.yaml
# Apply ConfigMaps
kubectl apply -f init-configmap.yaml
kubectl apply -f configmap.yaml
# Build Docker image
docker build -t your-registry/minecraft-biohazard:latest .
# Update image tag in statefulset.yaml
# Deploy
kubectl apply -f statefulset.yaml
kubectl apply -f service.yaml
Metodo 2: Con script
chmod +x deploy.sh
./deploy.sh
Monitoraggio
# Check pod status
kubectl get pods -n minecraft
kubectl logs -n minecraft -f <pod-name>
# Port-forward per accesso locale
kubectl port-forward -n minecraft svc/minecraft-service 25565:25565
# Check logs
kubectl logs -n minecraft statefulset/minecraft-server -f
Accesso
Dopo il deployment, ottenere l'IP del LoadBalancer:
kubectl get svc -n minecraft minecraft-service -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
Connessione in-game: IP:25565
Configurazione
Modificare server.properties
Modificare il ConfigMap minecraft-config:
kubectl edit configmap minecraft-config -n minecraft
Poi restartare il pod:
kubectl rollout restart statefulset minecraft-server -n minecraft
Aggiungere mods manualmente
- Copiare i mods in
/data/mods/dentro il PVC - Restartare il server
Backup
Il PVC minecraft-data contiene tutto il world data. Per backup:
# Create snapshot
kubectl apply -f trivy-pvc.yaml # usa trivy-pvc.yaml come template
# O montare il PVC in un pod di backup
Troubleshooting
Pod in CrashLoopBackOff
kubectl logs -n minecraft <pod-name> -f
kubectl describe pod -n minecraft <pod-name>
Modpack non installato
Controllare gli script in /docker-entrypoint-initd/:
kubectl exec -n minecraft <pod-name> -- ls -la /docker-entrypoint-initd/
Modificare resource limits
Modificare lo StatefulSet:
kubectl edit statefulset minecraft-server -n minecraft
Struttura del PVC
Dopo il primo avvio, il PVC conterrà:
/data/
├── server.jar
├── mods/
├── configs/
├── saves/
├── logs/
└── server.properties
Note
- Il server scarica il modpack da CurseForge durante il primo avvio
- È consigliato impostare
online-mode=falseper evitare problemi di autenticazione - Per produzione, considerare l'uso di un registro Docker privato
- Il backup del PVC è fondamentale per preservare il world data
Description