Skip to content

Instantly share code, notes, and snippets.

@wates
Last active September 13, 2019 02:10
Show Gist options
  • Save wates/9cdb561963de80bfb5ec54fe2c6ac352 to your computer and use it in GitHub Desktop.
Save wates/9cdb561963de80bfb5ec54fe2c6ac352 to your computer and use it in GitHub Desktop.
minecraft
apiVersion: v1
kind: Service
metadata:
labels:
app: minecraft
name: minecraft-backdoor
spec:
type: LoadBalancer
externalTrafficPolicy: Cluster
ports:
- name: minecraft
port: 25565
protocol: TCP
targetPort: minecraft
selector:
app: minecraft
sessionAffinity: None
apiVersion: v1
kind: ConfigMap
metadata:
name: backup-script
data:
cron-backup-script: |
#!/bin/sh
DATE=`date +%Y%m%d_%H%M`
cd /data
tar -zcf backup/${DATE}.tar.gz reality
echo "backup ${DATE}"
cd backup
find ./ -mtime +8 -delete
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: minecraft
name: minecraft
spec:
replicas: 1
serviceName: minecraft
selector:
matchLabels:
app: minecraft
template:
metadata:
labels:
app: minecraft
spec:
containers:
- name: crond
image: alpine:3.8
securityContext:
runAsUser: 0
command:
- crond
- -l
- "2"
- -f
volumeMounts:
- name: backup-script
mountPath: /etc/periodic/15min
- name: minecraft-datadir
mountPath: /data
- env:
- name: EULA
value: "false"
- name: TYPE
value: SPIGOT
- name: VERSION
value: 1.14.4
- name: DIFFICULTY
value: easy
- name: WHITELIST
- name: OPS
- name: ICON
- name: MAX_PLAYERS
value: "50"
- name: MAX_WORLD_SIZE
value: "5000"
- name: ALLOW_NETHER
value: "true"
- name: ANNOUNCE_PLAYER_ACHIEVEMENTS
value: "true"
- name: ENABLE_COMMAND_BLOCK
value: "true"
- name: FORCE_gameMode
value: "false"
- name: GENERATE_STRUCTURES
value: "true"
- name: HARDCORE
value: "false"
- name: MAX_BUILD_HEIGHT
value: "256"
- name: MAX_TICK_TIME
value: "60000"
- name: SPAWN_ANIMALS
value: "true"
- name: SPAWN_MONSTERS
value: "true"
- name: SPAWN_NPCS
value: "true"
- name: VIEW_DISTANCE
value: "10"
- name: SEED
- name: MODE
value: survival
- name: MOTD
value: King of Builder
- name: PVP
value: "false"
- name: LEVEL_TYPE
value: DEFAULT
- name: GENERATOR_SETTINGS
- name: LEVEL
value: reality
- name: ONLINE_MODE
value: "true"
- name: JVM_OPTS
value: -Xmx5120M -Xms5120M
image: itzg/minecraft-server:latest
imagePullPolicy: Always
name: minecraft
ports:
- containerPort: 25565
name: minecraft
protocol: TCP
resources:
requests:
cpu: "3"
memory: 6000Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /data
name: minecraft-datadir
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext:
fsGroup: 2000
runAsUser: 1000
terminationGracePeriodSeconds: 30
volumes:
- name: backup-script
configMap:
defaultMode: 0777
name: backup-script
volumeClaimTemplates:
- metadata:
name: minecraft-datadir
spec:
storageClassName: ssd
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 50Gi
apiVersion: v1
kind: Service
metadata:
labels:
app: minecraft
name: minecraft
spec:
type: LoadBalancer
externalTrafficPolicy: Cluster
ports:
- name: minecraft
port: 25565
protocol: TCP
targetPort: minecraft
selector:
app: minecraft
sessionAffinity: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment