Switched k8s example to use StatefulSet

This commit is contained in:
Geoff Bourne committed 2020-05-14 19:45:06 -05:00
1 parent da321b9a53
commit ab45a785e2
1 file changed
+47 -63
+47 -63
View File
@@ -1,75 +1,54 @@
--- ---
kind: PersistentVolumeClaim apiVersion: apps/v1
apiVersion: v1 kind: StatefulSet
metadata: metadata:
labels:
app: bds
name: bds name: bds
spec: spec:
# never more than 1 since BDS is not horizontally scalable
replicas: 1
serviceName: bds
selector:
matchLabels:
app: bds
template:
metadata:
labels:
app: bds
spec:
containers:
- name: main
image: itzg/minecraft-bedrock-server
volumeMounts:
- mountPath: /data
name: data
env:
- name: EULA
value: "TRUE"
ports:
- containerPort: 19132
protocol: UDP
readinessProbe: &probe
exec:
command:
- mc-monitor
- status-bedrock
- --host
# force health check against IPv4 port
- 127.0.0.1
initialDelaySeconds: 30
livenessProbe: *probe
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: accessModes:
- ReadWriteOnce - ReadWriteOnce
resources: resources:
requests: requests:
storage: 1Gi storage: 1Gi
--- ---
apiVersion: apps/v1
kind: Deployment
metadata:
name: bds
labels:
app: bds
spec:
replicas: 1
template:
metadata:
name: bds
labels:
app: bds
spec:
containers:
- name: bds
image: itzg/minecraft-bedrock-server
imagePullPolicy: Always
env:
- name: EULA
value: "TRUE"
- name: GAMEMODE
value: survival
- name: DIFFICULTY
value: normal
volumeMounts:
- mountPath: /data
name: data
livenessProbe:
exec:
command:
- /usr/local/bin/mc-monitor
- status-bedrock
- --host
- 127.0.0.1
- --port
- "19132"
initialDelaySeconds: 120
timeoutSeconds: 10
failureThreshold: 10
readinessProbe:
exec:
command:
- /usr/local/bin/mc-monitor
- status-bedrock
- --host
- 127.0.0.1
- --port
- "19132"
initialDelaySeconds: 120
periodSeconds: 10
failureThreshold: 10
volumes:
- name: data
persistentVolumeClaim:
claimName: bds
selector:
matchLabels:
app: bds
---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
@@ -80,4 +59,9 @@ spec:
ports: ports:
- port: 19132 - port: 19132
protocol: UDP protocol: UDP
type: LoadBalancer ipFamily: IPv4
# Use LoadBalancer if running on a provider that supports that
# type: LoadBalancer
# or use NodePort on a non-managed system;
# however, you'll need to lookup port assigned to the service
type: NodePort