mirror of
https://github.com/itzg/mc-router.git
synced 2024-12-22 16:17:38 +01:00
be33d2c9d1
* Update the image version in the example file https://github.com/itzg/mc-router/issues/7 Deployed it with an older version. Works but ends up spiking in CPU usage. Easy to overlook. Also, for good measure/best practice, added resource request/limit. * Bad syntax on CPU limit value
175 lines
3.2 KiB
YAML
175 lines
3.2 KiB
YAML
---
|
|
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: mc-router
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRole
|
|
metadata:
|
|
name: services-watcher
|
|
rules:
|
|
- apiGroups: [""]
|
|
resources: ["services"]
|
|
verbs: ["watch","list"]
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRoleBinding
|
|
metadata:
|
|
name: mc-router-services-watcher
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: mc-router
|
|
namespace: default
|
|
roleRef:
|
|
kind: ClusterRole
|
|
name: services-watcher
|
|
apiGroup: rbac.authorization.k8s.io
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: mc-router
|
|
spec:
|
|
type: NodePort
|
|
ports:
|
|
- targetPort: web
|
|
name: web
|
|
port: 8080
|
|
nodePort: 25580
|
|
- targetPort: proxy
|
|
name: proxy
|
|
port: 25565
|
|
nodePort: 25565
|
|
selector:
|
|
run: mc-router
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
labels:
|
|
run: mc-router
|
|
name: mc-router
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
run: mc-router
|
|
strategy:
|
|
type: Recreate
|
|
template:
|
|
metadata:
|
|
labels:
|
|
run: mc-router
|
|
spec:
|
|
serviceAccountName: mc-router
|
|
containers:
|
|
- image: itzg/mc-router:latest
|
|
name: mc-router
|
|
args: ["--api-binding", ":8080", "--in-kube-cluster"]
|
|
ports:
|
|
- name: proxy
|
|
containerPort: 25565
|
|
- name: web
|
|
containerPort: 8080
|
|
resources:
|
|
requests:
|
|
memory: 50Mi
|
|
cpu: "100m"
|
|
limits:
|
|
memory: 100Mi
|
|
cpu: "250m"
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: mc-stable
|
|
annotations:
|
|
"mc-router.itzg.me/externalServerName": "mc.your.domain"
|
|
spec:
|
|
ports:
|
|
- port: 25565
|
|
selector:
|
|
run: mc-stable
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
labels:
|
|
run: mc-stable
|
|
name: mc-stable
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
run: mc-stable
|
|
template:
|
|
metadata:
|
|
labels:
|
|
run: mc-stable
|
|
spec:
|
|
securityContext:
|
|
runAsUser: 1000
|
|
fsGroup: 1000
|
|
containers:
|
|
- image: itzg/minecraft-server
|
|
name: mc-stable
|
|
env:
|
|
- name: EULA
|
|
value: "TRUE"
|
|
ports:
|
|
- containerPort: 25565
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /data
|
|
volumes:
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: mc-stable
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: mc-snapshot
|
|
annotations:
|
|
"mc-router.itzg.me/externalServerName": "snapshot.your.domain"
|
|
spec:
|
|
ports:
|
|
- port: 25565
|
|
selector:
|
|
run: mc-snapshot
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
labels:
|
|
run: mc-snapshot
|
|
name: mc-snapshot
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
run: mc-snapshot
|
|
template:
|
|
metadata:
|
|
labels:
|
|
run: mc-snapshot
|
|
spec:
|
|
securityContext:
|
|
runAsUser: 1000
|
|
fsGroup: 1000
|
|
containers:
|
|
- image: itzg/minecraft-server
|
|
name: mc-snapshot
|
|
env:
|
|
- name: EULA
|
|
value: "TRUE"
|
|
- name: VERSION
|
|
value: "SNAPSHOT"
|
|
ports:
|
|
- containerPort: 25565
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /data
|
|
volumes:
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: mc-snapshot
|