Series: Kubernetes at home
- Kubernetes at home - Part 1: The hardware - January 02, 2021
- Kubernetes at home - Part 2: The install - January 05, 2021
- Kubernetes at home - Part 3: HAProxy Ingress - January 05, 2021
- Kubernetes at home - Part 4: DNS and a certificate with HAProxy Ingress - January 07, 2021
- Kubernetes at home - Part 5: Keycloak for authentication - January 16, 2021
- Kubernetes at home - Part 6: Keycloak authentication and Azure Active Directory - January 17, 2021
- Kubernetes at home - Part 7: Grafana, Prometheus, and the beginnings of monitoring - January 26, 2021
- Kubernetes at home - Part 8: MinIO initialization - March 01, 2021
Kubernetes at home - Part 9: Minecraft World0 - April 24, 2021
- Kubernetes at home - Part 10: Wiping the drives - May 09, 2021
- Kubernetes at home - Part 11: Trying Harvester and Rancher on the bare metal server - May 29, 2021
- Kubernetes at home - Part 12: Proxmox at home - December 23, 2021
Kubernetes at home - Part 9: Minecraft World0
I want to run a Minecraft service on my home network.
For reference, I started from this wonderful guide.
daniel@bequiet:~$ kubectl label node danielamd type=local
node/danielamd labeled
daniel@bequiet:~/development/k8s-home/minecraft$ kubectl create namespace minecraft-world0
namespace/minecraft-world0 created
Persistent Volume
kind: PersistentVolume
apiVersion: v1
metadata:
name: minecraft-pv-world0
labels:
type: local
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
capacity:
storage: 50Gi
hostPath:
path: "/media/working/minecraft/world0"
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: type
operator: In
values:
- local
Minecraft deployment
Key things to notice:
- hostNetwork=true. Not good practice, but I am letting the default minecraft port 25565 be open.
- spec.strategy.type=Recreate. When updating deployments, I want all pods to stop before recreating. Minecraft likes to lock files.
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: minecraft-pvc-world0
namespace: minecraft-world0
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: minecraft-server-world0
namespace: minecraft-world0
labels:
app: minecraft-server
spec:
strategy:
type: Recreate
replicas: 1
selector:
matchLabels:
app: minecraft-server
template:
metadata:
labels:
app: minecraft-server
spec:
hostNetwork: true
volumes:
- name: minecraft-pv-world0
persistentVolumeClaim:
claimName: minecraft-pvc-world0
containers:
- name: minecraft-server
image: itzg/minecraft-server:latest
resources:
limits:
memory: 4Gi
requests:
memory: 2Gi
env:
- name: EULA
value: 'TRUE'
- name: MODE
value: creative
- name: MOTD
value: Daniel's Minecraft server
- name: ALLOW_FLIGHT
value: 'TRUE'
ports:
- containerPort: 25565
name: minecraft
volumeMounts:
- name: minecraft-pv-world0
mountPath: /data
readinessProbe:
exec:
command:
- mcstatus
- 127.0.0.1
- ping
initialDelaySeconds: 30
periodSeconds: 30
livenessProbe:
exec:
command:
- mcstatus
- 127.0.0.1
- ping
initialDelaySeconds: 30
periodSeconds: 30
Address
I am already routing wildcard for my domain to that single-node cluster. And since the default port is being used, it just naturally works.
Series: Kubernetes at home
- Kubernetes at home - Part 1: The hardware - January 02, 2021
- Kubernetes at home - Part 2: The install - January 05, 2021
- Kubernetes at home - Part 3: HAProxy Ingress - January 05, 2021
- Kubernetes at home - Part 4: DNS and a certificate with HAProxy Ingress - January 07, 2021
- Kubernetes at home - Part 5: Keycloak for authentication - January 16, 2021
- Kubernetes at home - Part 6: Keycloak authentication and Azure Active Directory - January 17, 2021
- Kubernetes at home - Part 7: Grafana, Prometheus, and the beginnings of monitoring - January 26, 2021
- Kubernetes at home - Part 8: MinIO initialization - March 01, 2021
Kubernetes at home - Part 9: Minecraft World0 - April 24, 2021
- Kubernetes at home - Part 10: Wiping the drives - May 09, 2021
- Kubernetes at home - Part 11: Trying Harvester and Rancher on the bare metal server - May 29, 2021
- Kubernetes at home - Part 12: Proxmox at home - December 23, 2021