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
+34 -50
+34 -50
View File
@@ -1,74 +1,53 @@
--- ---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: bds
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: StatefulSet
metadata: metadata:
name: bds
labels: labels:
app: bds app: bds
name: bds
spec: spec:
# never more than 1 since BDS is not horizontally scalable
replicas: 1 replicas: 1
serviceName: bds
selector:
matchLabels:
app: bds
template: template:
metadata: metadata:
name: bds
labels: labels:
app: bds app: bds
spec: spec:
containers: containers:
- name: bds - name: main
image: itzg/minecraft-bedrock-server image: itzg/minecraft-bedrock-server
imagePullPolicy: Always
env:
- name: EULA
value: "TRUE"
- name: GAMEMODE
value: survival
- name: DIFFICULTY
value: normal
volumeMounts: volumeMounts:
- mountPath: /data - mountPath: /data
name: data name: data
livenessProbe: env:
- name: EULA
value: "TRUE"
ports:
- containerPort: 19132
protocol: UDP
readinessProbe: &probe
exec: exec:
command: command:
- /usr/local/bin/mc-monitor - mc-monitor
- status-bedrock - status-bedrock
- --host - --host
# force health check against IPv4 port
- 127.0.0.1 - 127.0.0.1
- --port initialDelaySeconds: 30
- "19132" livenessProbe: *probe
initialDelaySeconds: 120 volumeClaimTemplates:
timeoutSeconds: 10 - metadata:
failureThreshold: 10 name: data
readinessProbe: spec:
exec: accessModes:
command: - ReadWriteOnce
- /usr/local/bin/mc-monitor resources:
- status-bedrock requests:
- --host storage: 1Gi
- 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
@@ -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