Cloud Native 5 min read

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.

Programmer DD
Programmer DD
Programmer DD
Turn Kubernetes Pods into Minecraft Houses with Kubecraft

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/kubecraft

Kubernetes 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: 25565

Both 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/config

Another 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

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DeploymentYAMLMinecraftkubecraft
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.