Files
kubedoom/README.md

128 lines
3.6 KiB
Markdown
Raw Permalink Normal View History

2019-09-01 20:43:02 +01:00
# Kube DOOM
## Kill Kubernetes pods using Id's Doom!
The next level of chaos engineering is here! Kill pods inside your Kubernetes
cluster by shooting them in Doom!
This is a fork of the excellent
[gideonred/dockerdoomd](https://github.com/gideonred/dockerdoomd) using a
slightly modified Doom, forked from https://github.com/gideonred/dockerdoom,
which was forked from psdoom.
2019-09-01 20:54:27 +01:00
![DOOM](assets/doom.jpg)
2020-10-09 16:57:10 +01:00
## Running Locally
2019-09-01 20:43:02 +01:00
2020-10-09 18:48:37 +01:00
In order to run locally you will need to
2020-10-09 16:57:10 +01:00
2020-10-09 18:48:37 +01:00
1. Run the kubedoom container
2020-10-09 16:57:10 +01:00
2. Attach a VNC client to the appropriate port (5901)
### With Docker
Run `ghcr.io/storax/kubedoom:latest` with docker locally:
2019-09-01 20:43:02 +01:00
```console
2020-05-17 09:29:30 +01:00
$ docker run -p5901:5900 \
--net=host \
-v ~/.kube:/root/.kube \
--rm -it --name kubedoom \
ghcr.io/storax/kubedoom:latest
```
Optionally, if you set `-e NAMESPACE={your namespace}` you can limit Kubedoom to deleting pods in a single namespace
2020-10-09 16:57:10 +01:00
### With Podman
Run `ghcr.io/storax/kubedoom:latest` with podman locally:
2020-10-09 16:57:10 +01:00
```console
$ podman run -it -p5901:5900/tcp \
-v ~/.kube:/tmp/.kube --security-opt label=disable \
2020-10-09 18:48:37 +01:00
--env "KUBECONFIG=/tmp/.kube/config" --name kubedoom
ghcr.io/storax/kubedoom:latest
2020-10-09 16:57:10 +01:00
```
### Attaching a VNC Client
2020-10-09 18:48:37 +01:00
Now start a VNC viewer and connect to `localhost:5901`. The password is `idbehold`:
```console
2020-05-17 09:29:30 +01:00
$ vncviewer viewer localhost:5901
```
You should now see DOOM! Now if you want to get the job done quickly enter the
cheat `idspispopd` and walk through the wall on your right. You should be
greeted by your pods as little pink monsters. Press `CTRL` to fire. If the
pistol is not your thing, cheat with `idkfa` and press `5` for a nice surprise.
Pause the game with `ESC`.
2020-05-17 09:29:30 +01:00
### Killing namespaces
Kubedoom now also supports killing namespaces [in case you have too many of
them](https://github.com/storax/kubedoom/issues/5). Simply set the `-mode` flag
to `namespaces`:
```console
$ docker run -p5901:5900 \
--net=host \
-v ~/.kube:/root/.kube \
--rm -it --name kubedoom \
ghcr.io/storax/kubedoom:latest \
2020-05-17 09:29:30 +01:00
-mode namespaces
```
### Running Kubedoom inside Kubernetes
See the example in the `/manifest` directory. You can quickly test it using
[kind](https://github.com/kubernetes-sigs/kind). Create a cluster with the
example config from this repository:
2019-09-01 20:43:02 +01:00
```console
$ kind create cluster --config kind-config.yaml
Creating cluster "kind" ...
✓ Ensuring node image (kindest/node:v1.23.0) 🖼
2020-02-15 19:36:30 +00:00
✓ Preparing nodes 📦 📦
✓ Writing configuration 📜
2019-09-01 20:43:02 +01:00
✓ Starting control-plane 🕹️
✓ Installing CNI 🔌
✓ Installing StorageClass 💾
✓ Joining worker nodes 🚜
2020-02-15 19:36:30 +00:00
Set kubectl context to "kind-kind"
You can now use your cluster with:
2019-09-01 20:43:02 +01:00
2020-02-15 19:36:30 +00:00
kubectl cluster-info --context kind-kind
2020-10-09 18:48:37 +01:00
Not sure what to do next? 😅 Check out https://kind.sigs.k8s.io/docs/user/quick-start/
2019-09-01 20:43:02 +01:00
```
This will spin up a 2 node cluster inside docker, with port 5900 exposed from
the worker node. Then run kubedoom inside the cluster by applying the manifest
provided in this repository:
```console
$ kubectl apply -k manifest/
2019-09-01 20:43:02 +01:00
namespace/kubedoom created
deployment.apps/kubedoom created
serviceaccount/kubedoom created
clusterrolebinding.rbac.authorization.k8s.io/kubedoom created
```
2020-05-17 09:29:30 +01:00
To connect run:
```console
$ vncviewer viewer localhost:5900
```
2019-09-01 20:43:02 +01:00
Kubedoom requires a service account with permissions to list all pods and delete
them and uses kubectl 1.23.2.
## Building Kubedoom
The repository contains a Dockerfile to build the kubedoom image. You have to
specify your systems architecture as the `TARGETARCH` build argument. For
example `amd64` or `arm64`.
```console
$ docker build --build-arg=TARGETARCH=amd64 -t kubedoom .
```
To change the default VNC password, use `--build-arg=VNCPASSWORD=differentpw`.