aboutsummaryrefslogtreecommitdiff
path: root/kube/minecraft-vanilla.yaml
blob: 82ee3021ed5bad0f686a2fef8a100c859bf281b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    app.kubernetes.io/name: minecraft
  name: vanilla
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 8Gi
  storageClassName: itsuki
  volumeMode: Filesystem
---
apiVersion: v1
kind: Service
metadata:
  name: vanilla
  labels:
    app.kubernetes.io/name: minecraft
spec:
  type: ClusterIP
  ports:
    - port: 25565
      name: main
    - port: 25575
      name: rcon
      protocol: UDP
  selector:
    app.kubernetes.io/name: minecraft
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: vanilla
  labels:
    app.kubernetes.io/name: minecraft
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: minecraft
  template:
    metadata:
      labels:
        app.kubernetes.io/name: minecraft
    spec:
      containers:
        - image: ghcr.io/xe/made-cap:latest
          imagePullPolicy: Always
          name: vanilla
          env:
            # Use secret in real usage
            - name: EULA
              value: "true"
            - name: "MEMORY"
              value: "4G"
            - name: "USE_AIKAR_FLAGS"
              value: "true"
          securityContext:
            runAsUser: 1000
            runAsGroup: 1000
            runAsNonRoot: true
            allowPrivilegeEscalation: false
            capabilities:
              drop:
                - ALL
            seccompProfile:
              type: RuntimeDefault
          ports:
            - containerPort: 25565
              name: main
            - containerPort: 25575
              name: rcon
              protocol: UDP
          readinessProbe:
            exec:
              command:
                ["/usr/local/bin/mc-monitor", "status", "--host", "localhost"]
            # Give it i + p * f seconds to be ready, so 120 seconds
            initialDelaySeconds: 20
            periodSeconds: 5
            failureThreshold: 20
          # Monitor ongoing liveness
          livenessProbe:
            exec:
              command:
                ["/usr/local/bin/mc-monitor", "status", "--host", "localhost"]
            initialDelaySeconds: 120
            periodSeconds: 60
          volumeMounts:
            - name: mc-data
              mountPath: /data
      volumes:
        - name: mc-data
          persistentVolumeClaim:
            claimName: vanilla