Agentic AI

Running OpenClaw on Kubernetes: A Technical Tutorial

August 8, 2026 Kubezilla Team 3 min read

Background

OpenClaw reimplements the original game’s logic in C++ using SDL2, while the original game assets must be supplied separately by the user since they are copyrighted. Kubernetes is a container orchestration system that manages deployment, scaling, and networking of containerized workloads across a cluster of machines.

Because OpenClaw is a real-time graphical application rather than a stateless web service, running it in Kubernetes typically means either building it inside a container for headless CI purposes, or running it with a virtual display and streaming output via VNC so it can be accessed remotely.

Building a Docker image

A minimal Dockerfile for compiling and running OpenClaw headlessly with a virtual display might look like this:


FROM ubuntu:22.04

RUN apt-get update && apt-get install -y \
    build-essential cmake git \
    libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev \
    x11vnc xvfb fluxbox novnc websockify \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /opt
RUN git clone --depth 1 https://github.com/pjasicek/OpenClaw.git openclaw

WORKDIR /opt/openclaw
RUN mkdir build && cd build && cmake .. && make -j$(nproc)

VOLUME ["/opt/openclaw/assets"]

EXPOSE 6080
CMD ["bash", "-c", "Xvfb :1 -screen 0 1280x720x24 & fluxbox & x11vnc -display :1 -forever -nopw & websockify --web=/usr/share/novnc 6080 localhost:5900"]

Build the image and push it to a registry your cluster can pull from:


docker build -t your-registry/openclaw:latest .
docker push your-registry/openclaw:latest

Kubernetes manifests

A Deployment and Service to run this in a cluster, exposing the noVNC web interface, might look like this:


apiVersion: apps/v1
kind: Deployment
metadata:
  name: openclaw
spec:
  replicas: 1
  selector:
    matchLabels:
      app: openclaw
  template:
    metadata:
      labels:
        app: openclaw
    spec:
      containers:
        - name: openclaw
          image: your-registry/openclaw:latest
          ports:
            - containerPort: 6080
          resources:
            requests:
              cpu: "500m"
              memory: "512Mi"
            limits:
              cpu: "1"
              memory: "1Gi"
          volumeMounts:
            - name: assets
              mountPath: /opt/openclaw/assets
      volumes:
        - name: assets
          persistentVolumeClaim:
            claimName: openclaw-assets-pvc
---
apiVersion: v1
kind: Service
metadata:
  name: openclaw-service
spec:
  selector:
    app: openclaw
  ports:
    - port: 80
      targetPort: 6080
  type: ClusterIP

Because replicas beyond 1 don’t make sense for a single interactive session, this workload is best modeled as a per-user deployment spun up on demand, rather than horizontally scaled like a typical web app.

Supplying game assets

Since the original assets are proprietary, you’d typically use an init container or a PersistentVolumeClaim populated ahead of time to inject them, rather than baking them into the image, to stay compliant with licensing.

Accessing the game

Once deployed, expose the Service via an Ingress or port-forward for testing:


kubectl port-forward svc/openclaw-service 8080:80

Then open http://localhost:8080 in a browser to reach the noVNC session and play the game remotely.

Notes on scaling and lifecycle

For multi-user scenarios, you’d generally pair this with a controller that creates one Pod per active user session, similar to how cloud gaming platforms or notebook spawners work, plus a readiness probe checking the VNC port and an idle-timeout mechanism to reclaim resources when a session ends.

Leave a comment