Skip to content
/ serpent Public

Chaos snake for Kubernetes. Chaos engineering combined with a classic snake game.

Notifications You must be signed in to change notification settings

deggja/serpent

Repository files navigation

Serpent

Control snake. Eat food. Create chaos.

Contents

⭐ What is Serpent? ⭐

Serpent lets you play snake while wrecking havock in your Kubernetes cluster. Have fun while you can.

How does it work? 🤔

Each piece of food you eat corresponds to a pod in your cluster (I left out kube-system though..).

Installation

Homebrew 🍺

To install Serpent using Homebrew, you can run the following commands:

brew tap deggja/serpent https://github.com/deggja/serpent
brew install serpent

Build from source 💻

To build Serpent from the source, you need a working Go environment with version 1.21 or higher. Follow these steps:

git clone https://github.com/deggja/serpent.git --depth 1
cd serpent
go build -o serpent

Usage

Starting the game

To start the game, simply run the compiled binary:

./serpent

This will run the game in default mode. The snake will only eat resources of type pod and avoid system critical workloads in kube-system.

To specify a configuration file, use the --config/-c flag.

./serpent --config config.json

This will run the game in config mode. The snake will eat all resource types in all namespaces defined in the configuration file.

Example Configuration File

{
    "resource_types": ["pods", "replicasets", "deployments", "services"],
    "namespaces": {
        "include": ["grafana", "default", "netfetch", "podinfo", "workloads"],
        "exclude": ["kube-system"]
    }

Playing Serpent

Use the arrow keys to navigate the snake around the screen:

Key Action
Arrow up Move up
Arrow down Move down
Arrow left Move left
Arrow right Move right
Space Pause or Resume
CTRL + C Quit the game

asciicast

Kubernetes interaction

Serpent will needs access to a Kubernetes cluster. Ensure your kubeconfig is set up correctly before starting the game. The application currently expects the default kubeconfig or a kubeconfig environment variable.

As you play and the pods are deleted, Serpent will log its actions to a chaos.log file for your review.

Contribute 🔨

Feel free to dive in! Open an issue or submit PRs.

Acknowledgments

This project utilizes Termloop, a simple Go library for creating terminal-based games. Thanks to the creators and contributors of Termloop for providing such a versatile tool.

License

Serpent is released under the MIT License. Check out the LICENSE file for more information.

About

Chaos snake for Kubernetes. Chaos engineering combined with a classic snake game.

Resources

Stars

Watchers

Forks

Packages

No packages published