Skip to content

Instantly share code, notes, and snippets.

@rudolfbyker
Last active May 25, 2024 10:45
Show Gist options
  • Save rudolfbyker/8d702632779b82e15bf0e551d54bbe4e to your computer and use it in GitHub Desktop.
Save rudolfbyker/8d702632779b82e15bf0e551d54bbe4e to your computer and use it in GitHub Desktop.
Hosting Unturned on Kubernetes

Hosting Unturned on Kubernetes

Helm chart

apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ .Release.Namespace | quote }}
name: unturned
data:
start.sh: |
#!/usr/bin/env bash
set -euo pipefail
# If in debug mode, just sleep forever.
if ${DEBUG}
then
echo "Debug mode enabled, sleeping forever."
sleep infinity
exit 0
fi
# Install or update server
/home/steam/steamcmd/steamcmd.sh +force_install_dir /data +login anonymous +@sSteamCmdForcePlatformBitness 64 +app_update 1110390 +quit
# Activate Legally Distinct Missile
if [ ! -d "/data/Modules/Rocket.Unturned" ]
then
cp -r /data/Extras/Rocket.Unturned /data/Modules/
fi
# Start our server
cd /data
./ServerHelper.sh +LanServer/Rusland
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: {{ .Release.Namespace | quote }}
name: unturned
labels:
app: unturned
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: unturned
template:
metadata:
labels:
app: unturned
spec:
nodeSelector:
name: pixie
initContainers:
# See https://serverfault.com/a/907160/301389
- name: volume-mount-hack
image: busybox
command: [ "sh", "-c", "chown -R 1000:1000 /data" ]
volumeMounts:
- mountPath: /data
name: data
containers:
- name: unturned
image: cm2network/steamcmd:latest
command: [ "/bin/bash", "/start.sh" ]
env:
- name: SERVER_TYPE
value: both
- name: STEAM_CMD_ARGS
value: ""
- name: DEBUG
value: "false"
ports:
- containerPort: 27015
- containerPort: 27016
volumeMounts:
- mountPath: /data
name: data
- mountPath: /start.sh
name: config
subPath: start.sh
volumes:
- name: data
persistentVolumeClaim:
claimName: unturned
- name: config
configMap:
name: unturned
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: {{ .Release.Namespace | quote }}
name: unturned
spec:
storageClassName: openebs-zfspv
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 4Gi
apiVersion: v1
kind: Service
metadata:
namespace: {{ .Release.Namespace | quote }}
name: unturned
spec:
selector:
app: unturned
type: NodePort
ports:
- protocol: UDP
port: 27015
targetPort: 27015
nodePort: 30215
name: unturned-queries
- protocol: UDP
port: 27016
targetPort: 27016
nodePort: 30216
name: unturned-traffic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment