107 lines
3.1 KiB
YAML
107 lines
3.1 KiB
YAML
---
|
|
# tasks file for ericomeehan.minecraft.eom.dev
|
|
- name: Create persistent volume for minecraft
|
|
k8s:
|
|
state: present
|
|
definition:
|
|
apiVersion: v1
|
|
kind: PersistentVolume
|
|
metadata:
|
|
name: minecraft-pv
|
|
spec:
|
|
capacity:
|
|
storage: 16Gi
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
persistentVolumeReclaimPolicy: Retain
|
|
storageClassName: standard
|
|
hostPath:
|
|
path: /mnt/data/minecraft-pv
|
|
nodeAffinity:
|
|
required:
|
|
nodeSelectorTerms:
|
|
- matchExpressions:
|
|
- key: kubernetes.io/hostname
|
|
operator: In
|
|
values:
|
|
- alpha-worker-0
|
|
|
|
- name: Create persistent volume claim for minecraft volume
|
|
k8s:
|
|
state: present
|
|
definition:
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: minecraft-pv-claim
|
|
namespace: {{ namespace }}
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 16Gi
|
|
storageClassName: standard
|
|
volumeName: minecraft-pv
|
|
|
|
- name: Create a Deployment
|
|
k8s:
|
|
definition:
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: minecraft-deployment
|
|
namespace: {{ namespace }}
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: minecraft
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: minecraft
|
|
spec:
|
|
containers:
|
|
- name: openminecraft
|
|
image: itzg/minecraft-server
|
|
volumeMounts:
|
|
- name: minecraft-pv
|
|
mountPath: /data
|
|
ports:
|
|
- containerPort: 25565
|
|
- containerPort: 24454
|
|
env:
|
|
- name: EULA
|
|
value: "TRUE"
|
|
- name: TYPE
|
|
value: "FABRIC"
|
|
- name: MODS
|
|
value: "https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/fabric,https://cdn.modrinth.com/data/bWrNNfkb/versions/D4KXqjtC/Floodgate-Fabric-2.2.3-SNAPSHOT%2Bbuild.28.jar,https://www.curseforge.com/api/v1/mods/306612/files/5510851/download,https://www.curseforge.com/api/v1/mods/416089/files/5500955/download"
|
|
volumes:
|
|
- name: minecraft-pv
|
|
persistentVolumeClaim:
|
|
claimName: minecraft-pv-claim
|
|
|
|
- name: Expose Deployment as a Service
|
|
k8s:
|
|
definition:
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: minecraft-service
|
|
namespace: {{ namespace }}
|
|
spec:
|
|
selector:
|
|
app: minecraft
|
|
ports:
|
|
- port: 24454
|
|
protocol: TCP
|
|
name: minecraft-port-24454
|
|
nodePort: {{ nodePorts[minecraft-port-24454] }}
|
|
- port: 25565
|
|
protocol: TCP
|
|
name: minecraft-port-25565
|
|
nodePort: {{ nodePorts[minecraft-port-25565] }}
|
|
type: NodePort
|