Skip to content

Repository files navigation

kubeinvaders (the original) 👾 aka k-inv 🕹️

Gamified Chaos Engineering and Educational Tool for Kubernetes

KubeInvaders

Inspired by the classic Space Invaders game, KubeInvaders offers a playful way to learn about Kubernetes resilience: every alien is a pod or a node, shoot it and watch how your cluster reacts under pressure.

Recommended by the CNCF and listed in the CNCF landscape (Observability and Analysis - Chaos Engineering), it is used for teaching Kubernetes, for resilience testing and at tech conferences such as DecompileD 2025. The project is backed by Platform Engineering and GDT - Garanti Del Talento, which provide enterprise-grade features and SRE experts. See also the FOSDEM 2023 slides.

Table of Contents

  1. Quick Start (no cluster required)
  2. Connect Your Cluster
  3. Running Legacy Version v1.9.7
  4. Documentation
  5. Community
  6. Community blogs and videos
  7. License

Quick Start (no cluster required)

The image embeds a demo Kubernetes cluster powered by KWOK, already connected to the game:

podman run --rm -p 8080:8080 docker.io/luckysideburn/kubeinvaders:latest
# or
docker run --rm -p 8080:8080 docker.io/luckysideburn/kubeinvaders:latest

Open http://localhost:8080 and start shooting. Nodes and pods are simulated: nothing real is deleted.

Want to use a real cluster? You can switch at any time from the Kubernetes Connection form in the web console, or start the container with -e KWOK_ENABLED=false and your cluster settings: see Connect Your Cluster.

Details and limitations in docs/kwok.md.

Connect Your Cluster

KubeInvaders runs as a container (Podman or Docker) and talks to your cluster with a ServiceAccount token.

Helm: an official Helm chart is currently not supported, but you can create your own to run KubeInvaders inside your cluster. It only needs a Deployment exposing port 8080, a ServiceAccount bound to the permissions in manifests/kubeinvaders-rbac.yaml, and the NAMESPACE environment variable. Inside a pod the built-in KWOK demo cluster is disabled automatically. The legacy chart in helm-charts/ can be a starting point.

  1. Create the RBAC (Kubernetes v1.24+) and the target namespaces:

    kubectl apply -f manifests/kubeinvaders-rbac.yaml
    kubectl create namespace namespace1
    kubectl create namespace namespace2
  2. Get a token:

    TOKEN=$(kubectl get secret kinv-sa-token -n kubeinvaders -o go-template='{{.data.token | base64decode}}')
    # or a short-lived one
    TOKEN=$(kubectl create token kinv-sa -n kubeinvaders --duration=8h)
  3. Run KubeInvaders and connect it to your cluster, in one of two ways:

    • From the web console: run the container without the demo cluster, open http://localhost:8080 and fill in the Kubernetes Connection form: API endpoint, token, namespaces (comma-separated) and, for self-signed clusters, the CA certificate. You can also load everything from a KUBECONFIG file.

      podman run --rm -p 8080:8080 -e KWOK_ENABLED=false docker.io/luckysideburn/kubeinvaders:latest
    • With environment variables:

      podman run --rm -p 8080:8080 \
        -e KWOK_ENABLED=false \
        -e K8S_TOKEN=$TOKEN \
        -e KUBERNETES_SERVICE_HOST=<api-server-host> \
        -e KUBERNETES_SERVICE_PORT_HTTPS=<api-server-port> \
        -e NAMESPACE=namespace1,namespace2 \
        -e DISABLE_TLS=true \
        docker.io/luckysideburn/kubeinvaders:latest

      DISABLE_TLS=true skips the verification of the API server certificate; drop it if your cluster certificate is trusted.

If the token is missing, invalid or expired, KubeInvaders cannot call the Kubernetes API and game actions will fail.

The demo cluster starts only when no cluster is configured: passing K8S_TOKEN or running KubeInvaders inside a pod disables it automatically, and KWOK_ENABLED=false makes it explicit. A slim image without KWOK can be built with --build-arg WITH_KWOK=false.

Step-by-step example with MiniKube: docs/minikube.md.

Running Legacy Version v1.9.7

If you need to run the legacy version v1.9.7, first extract the service account token:

TOKEN=$(kubectl get secret -n kubeinvaders -o go-template='{{.data.token | base64decode}}' kinv-sa-token)

Then run the container with the required environment variables pointing to your cluster:

podman run -p 8080:8080 \
  --env APPLICATION_URL=http://localhost:8080 \
  --env K8S_TOKEN=$TOKEN \
  --env INSECURE_ENDPOINT=true \
  --env KUBERNETES_SERVICE_HOST=192.168.39.182 \
  --env KUBERNETES_SERVICE_PORT_HTTPS=8443 \
  --env NAMESPACE=namespace1,namespace2 \
  local/kubeinvaders:v1.9.7

Replace KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT_HTTPS with your cluster's API server address and port, and set NAMESPACE to a comma-separated list of the namespaces you want to target.

Documentation

Community

Please reach out for news, bugs, feature requests, and other issues via:

Community blogs and videos

Alt Text

License

KubeInvaders is licensed under the Apache 2.0 License. See LICENSE for the full license text.

Releases

Sponsor this project

Packages

Used by

Contributors

Languages