-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvanilla.yaml
209 lines (209 loc) · 6.25 KB
/
vanilla.yaml
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
apiVersion: v1
kind: Service
metadata:
name: mc-vanilla
labels:
app: mc-vanilla
annotations:
"mc-router.itzg.me/externalServerName": "oasis.learn.study"
spec:
ports:
- port: 25565
targetPort: 25565
name: minecraft
- port: 25575
targetPort: 25575
name: rcon
selector:
app: mc-vanilla
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: mc-vanilla-filebrowser
labels:
app: mc-vanilla
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
name: filebrowser
selector:
app: mc-vanilla
type: NodePort
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: mc-vanilla-filebrowser-ingress
annotations:
# kubernetes.io/ingress.global-static-ip-name: "oasis-learn-study"
spec:
rules:
- http:
paths:
- path: /asdlck29uawvasdiujn/*
pathType: ImplementationSpecific
backend:
service:
name: mc-vanilla-filebrowser
port:
number: 80
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mc-vanilla
spec:
selector:
matchLabels:
app: mc-vanilla
serviceName: "mc-vanilla"
replicas: 1
template:
metadata:
labels:
app: mc-vanilla
spec:
# https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod/ ?
# terminationGracePeriodSeconds: 13
containers:
# Using a fixed release tag instead of :latest always prevents unexpected surprises!
- image: itzg/minecraft-server:2021.27.0-java16-openj9
name: server
resources:
requests:
# https://cloud.google.com/kubernetes-engine/docs/concepts/autopilot-overview#allowable_resource_ranges
# The 512 should avoid "Warning: Autopilot increased resource requests (...) to meet requirements."
memory: "512Mi"
# 0.1 which gets rounded up to 0.25 (see above) makes start-up of Vanilla 1.17.1 take several minutes
# but 1 could be better than 2, because it would allow idle https://github.com/itzg/docker-minecraft-server/#autopaus
# to be priced for lower 0.9 instead of 1.03 Memory than the min. 1 GiB a 2 CPU pods gets charged, because of
# https://cloud.google.com/kubernetes-engine/docs/concepts/autopilot-overview
# But 1 vCPU takes 100s (1.5') to start-up, but with 4 vCPU only 17s, and with 8 vCPU it's 12s.
# Even though even a server without players will initially eat up all 8, the AutoPause will soon reduce it to 0.
cpu: "8"
limits:
memory: "4096Mi"
cpu: "8"
env:
# https://github.com/OASIS-learn-study/kubernetes.oasis.learn.study#memory-management
- name: JVM_XX_OPTS
# NB that e.g. USE_AIKAR_FLAGS doesn't really make sense anymore with OpenJ9, let's fail fast to avoid confusion
value: "-XX:-IgnoreUnrecognizedXXColonOptions"
- name: INIT_MEMORY
# this lets the JVM return unused heap memory to the OS!
value: "500M"
- name: MAX_MEMORY
# should probably be something a bit lower than container memory limit, but exactly is TBD
value: "1800M"
- name: USE_LARGE_PAGES
value: "true"
- name: TUNE_VIRTUALIZED
# https://www.eclipse.org/openj9/docs/xtunevirtualized/
value: "true"
- name: TUNE_NURSERY_SIZES
value: "true"
# Now other stuff not related to memory managment
- name: RCON_PASSWORD
valueFrom:
secretKeyRef:
name: mc-vanilla
key: rcon
- name: ENABLE_RCON
value: "true"
- name: VERSION
# https://github.com/itzg/docker-minecraft-server#versions
# NB 1.18.1 requires Java 17, but OpenJ9 only has Java 16, see:
# https://github.com/itzg/docker-minecraft-server/issues/1234
value: "1.17.1"
- name: MODE
value: "1"
- name: MOTD
value: "Minecraft Demo on Kubernetes"
- name: EULA
value: "true"
ports:
- containerPort: 25565
name: minecraft
- containerPort: 25575
name: rcon
# readinessProbe:
# exec:
# command:
# - mc-monitor
# - status
# initialDelaySeconds: 300
# periodSeconds: 300
# livenessProbe:
# exec:
# command:
# - mc-monitor
# - status
# initialDelaySeconds: 300
# periodSeconds: 300
volumeMounts:
- name: mc-data
mountPath: /data
# Using a fixed release tag instead of :latest always prevents unexpected surprises!
- image: itzg/mc-monitor:0.10.6
name: monitor
args:
- export-for-prometheus
env:
- name: EXPORT_SERVERS
value: "localhost:25565"
- name: EXPORT_PORT
value: "8080"
ports:
- containerPort: 8080
name: prometheus
resources:
requests:
# The http://g.co/gke/autopilot-resources default of 512 MiB is WAY too much for this, but for now:
memory: "512Mi"
cpu: "1"
limits:
memory: "512Mi"
cpu: "1"
- image: europe-docker.pkg.dev/oasis-learn-study/dev/kubernetes.oasis.learn.study-filebrowser:latest
name: filebrowser
volumeMounts:
- name: mc-data
mountPath: /srv
env:
- name: CONTEXT_ROOT
value: "/asdlck29uawvasdiujn"
ports:
- containerPort: 80
name: filebrowser
resources:
requests:
# The http://g.co/gke/autopilot-resources default of 512 MiB is WAY too much for this, but for now:
memory: "512Mi"
cpu: "1"
limits:
memory: "512Mi"
cpu: "1"
volumeClaimTemplates:
- metadata:
name: mc-data
spec:
accessModes: [ "ReadWriteOnce" ]
# storageClassName: "my-storage-class"
resources:
requests:
storage: 1Gi
---
apiVersion: monitoring.gke.io/v1alpha1
kind: PodMonitor
metadata:
name: mc-vanilla-monitor
spec:
selector:
matchLabels:
app: mc-vanilla
podMetricsEndpoints:
- port: prometheus