Merge pull request #21 from kbrewer92/k8s-manifest-addition
K8s manifest addition
This commit is contained in:
commit
44f153e301
2 changed files with 116 additions and 2 deletions
114
k8s_example.md
Normal file
114
k8s_example.md
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
# Kubernetes Example
|
||||
|
||||
## Disclaimer
|
||||
|
||||
Your mileage may vary depending on what storage you're using for your k8s cluster. This is not an officially supported method of orchastrating this container as it is designed for Docker in Unraid.
|
||||
|
||||
This was provided from a member of the community and their intentions was to give you a starting point if you found yourself here looking to try to use this container in k8s.
|
||||
|
||||
Remeber to either set nodeports manually or go get the assigment from your service so that you can properly port forward.
|
||||
|
||||
## Example Manifest
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: minecraft-all-the-mods-10
|
||||
labels:
|
||||
app: minecraft-all-the-mods-10
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 19565
|
||||
protocol: TCP
|
||||
name: "metrics"
|
||||
targetPort: "metrics"
|
||||
- port: 25575
|
||||
protocol: TCP
|
||||
name: "minecraft-rcon"
|
||||
targetPort: "minecraft-rcon"
|
||||
- port: 25565
|
||||
protocol: TCP
|
||||
name: "minecraft-game"
|
||||
targetPort: "minecraft-game"
|
||||
selector:
|
||||
app: minecraft-all-the-mods-10
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: minecraft-all-the-mods-10
|
||||
namespace: default
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: minecraft-all-the-mods-10
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: minecraft-all-the-mods-10
|
||||
spec:
|
||||
initContainers:
|
||||
- name: volume-ownership
|
||||
image: busybox
|
||||
command: ["sh", "-c", "chown -R 99:99 /data"]
|
||||
volumeMounts:
|
||||
- name: minecraft-data
|
||||
mountPath: /data
|
||||
containers:
|
||||
- name: minecraft-all-the-mods-10
|
||||
image: w3lfare/allthemods10:latest # Or specific version if needed
|
||||
env:
|
||||
- name: EULA
|
||||
value: "true"
|
||||
- name: MODE
|
||||
value: "survival"
|
||||
- name: MOTD
|
||||
value: "Hello World!"
|
||||
- name: LEVEL
|
||||
value: world
|
||||
- name: ENABLE_WHITELIST
|
||||
value: false
|
||||
- name: WHITELIST_USERS
|
||||
value: USERNAME
|
||||
- name: OP_USERS
|
||||
value: USERNAME
|
||||
- name: ALLOW_FLIGHT
|
||||
value: false
|
||||
- name: ONLINE_MODE
|
||||
value: true
|
||||
- name: INIT_MEMORY
|
||||
value: 8G
|
||||
- name: MAX_MEMORY
|
||||
value: 12G
|
||||
- name: RCON_PASSWORD
|
||||
value: "rcon-password"
|
||||
ports:
|
||||
- name: minecraft-game
|
||||
containerPort: 25565 # Expose port 25565
|
||||
- name: minecraft-rcon
|
||||
containerPort: 25575
|
||||
- name: metrics
|
||||
containerPort: 19565
|
||||
resources:
|
||||
requests:
|
||||
cpu: 4
|
||||
memory: "16Gi"
|
||||
limits:
|
||||
cpu: 6
|
||||
memory: "16Gi"
|
||||
volumeMounts:
|
||||
- name: minecraft-data
|
||||
mountPath: /data
|
||||
volumes:
|
||||
- name: minecraft-data
|
||||
persistentVolumeClaim:
|
||||
claimName: minecraft-data
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: minecraft-data
|
||||
spec:
|
||||
accessModes: [ "ReadWriteOnce" ]
|
||||
resources:
|
||||
requests:
|
||||
storage: 50Gi
|
||||
|
|
@ -50,7 +50,7 @@ fi
|
|||
if [[ -n "$ONLINE_MODE" ]]; then
|
||||
sed -i "s/online-mode=.*/online-mode=$ONLINE_MODE/" /data/server.properties
|
||||
fi
|
||||
[[ ! -f whitelist.json ]] && echo "[]" > whitelist.json
|
||||
echo "[]" > whitelist.json
|
||||
IFS=',' read -ra USERS <<< "$WHITELIST_USERS"
|
||||
for raw_username in "${USERS[@]}"; do
|
||||
username=$(echo "$raw_username" | xargs)
|
||||
|
|
@ -72,7 +72,7 @@ for raw_username in "${USERS[@]}"; do
|
|||
echo "Whitelist: Failed to fetch UUID for $username."
|
||||
fi
|
||||
done
|
||||
[[ ! -f ops.json ]] && echo "[]" > ops.json
|
||||
echo "[]" > ops.json
|
||||
IFS=',' read -ra OPS <<< "$OP_USERS"
|
||||
for raw_username in "${OPS[@]}"; do
|
||||
username=$(echo "$raw_username" | xargs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue