Turn Kubernetes Pods into Minecraft Houses with Kubecraft
This article introduces Dockercraft and its successor Kubecraft, explains how each Minecraft house represents a Docker container or Kubernetes pod, and provides step‑by‑step Docker and Kubernetes deployment instructions, including required YAML, ConfigMap creation, and essential container flags.
After Microsoft acquired Minecraft in 2015, it open‑sourced Dockercraft , a project that lets players start or stop Docker containers directly inside the game; each container appears as an N×N block house displaying its name, processes, CPU and memory usage.
Inspired by Dockercraft, the community created Kubecraft , which manages Kubernetes clusters in the same way: each house represents a Pod, and the house’s internal switch can destroy the pod.
Docker deployment (run the container):
$ docker run -t -d -i -p 25565:25565 \
--name kubecraft \
-e KUBE_CFG_FILE=/etc/kubeconfig \
-v ~/.kube/config:/etc/kubeconfig \
stevesloka/kubecraftKubernetes deployment (apply the following manifests):
apiVersion: apps/v1
kind: Deployment
metadata:
name: kubecraft
labels:
app: kubecraft
spec:
replicas: 1
selector:
matchLabels:
app: kubecraft
template:
metadata:
labels:
app: kubecraft
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- kubecraft
topologyKey: kubernetes.io/hostname
weight: 1
tolerations:
- key: node-role.kubernetes.io/ingress
operator: Exists
effect: NoSchedule
containers:
- name: kubecraft
image: stevesloka/kubecraft
tty: true
stdin: true
env:
- name: KUBE_CFG_FILE
value: /etc/kubeconfig
ports:
- containerPort: 25565
protocol: TCP
volumeMounts:
- mountPath: /etc/kubeconfig
subPath: kubeconfig
name: kubeconfig
volumes:
- name: kubeconfig
configMap:
name: kubeconfig
---
apiVersion: v1
kind: Service
metadata:
name: kubecraft
labels:
app: kubecraft
spec:
selector:
app: kubecraft
ports:
- protocol: TCP
name: http
port: 25565
targetPort: 25565Both tty: true and stdin: true are mandatory; otherwise the container will not start.
Before deploying, create a ConfigMap to store the kubeconfig file, e.g.:
$ kubectl create cm kubeconfig --from-file=/root/.kube/configAnother related project, KubeCraftAdmin , uses animals to represent pods—killing a chicken deletes the corresponding pod.
References:
Dockercraft – https://github.com/docker/dockercraft
Kubecraft – https://github.com/stevesloka/kubecraft
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
