Science and technology

Play Doom on Kubernetes | Opensource.com

Do you ever really feel nostalgic for Doom and different blocky video video games, those that did not require way more than a mouse and the hope that you may survive on a LAN with your folks? You know what I am speaking about; the times when your weekends have been consumed with determining how you may journey along with your desktop and what number of Mountain Dews you may slot in your cargo pants pockets? If this reminiscence places a heat feeling in your coronary heart, nicely, this text is for you.

Get able to play Doom once more, solely this time you will be taking part in for a authentic work purpose: doing chaos engineering. I will be utilizing my fork of Kube DOOM (with a brand new Helm chart as a result of that is how I generally spend my weekends). I even have a pull request with the original Kube DOOM creator that I am ready to listen to about.

The first article on this sequence defined what chaos engineering is, and the second demonstrated easy methods to get your system’s steady state as a way to evaluate it towards a chaos state. In the following few articles, I launched some chaos engineering instruments you should use: Litmus for testing arbitrary failures and experiments in your Kubernetes cluster; Chaos Mesh, an open supply chaos orchestrator with an internet person interface; and Kube-monkey for stress-testing your programs by scheduling random termination pods in your cluster.

In this sixth article, I will use Pop!_OS 20.04, Helm three, Minikube 1.14.2, a VNC viewer, and Kubernetes 1.19.

Configure Minikube

If you have not already, install Minikube in no matter method that is smart in your setting. If you may have sufficient assets, I like to recommend giving your digital machine a bit greater than the default reminiscence and CPU energy:

$ minikube config set reminiscence 8192
❗  These modifications will take impact upon a minikube delete and then a minikube begin
$ minikube config set cpus 6
❗  These modifications will take impact upon a minikube delete and then a minikube begin

Then begin and test the standing of your system:

$ minikube begin
?  minikube v1.14.2 on Debian bullseye/sid
?  minikube 1.19.zero is out there! Download it: https://github.com/kubernetes/minikube/releases/tag/v1.19.zero
?  To disable this discover, run: 'minikube config set WantUpdateNotification false'

✨  Using the docker driver based mostly on person configuration
?  Starting management airplane node minikube in cluster minikube
?  Creating docker container (CPUs=6, Memory=8192MB) ...
?  Preparing Kubernetes v1.19.zero on Docker 19.03.eight ...
?  Verifying Kubernetes parts...
?  Enabled addons: storage-provisioner, default-storageclass
?  Done! kubectl is now configured to make use of "minikube" by default
$ minikube standing
minikube
kind: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured

Preinstall pods with Helm

Before shifting ahead, you will have to deploy some pods into your cluster. To do that, I generated a easy Helm chart and adjusted the replicas in my values file from 1 to eight.

If it’s good to generate a Helm chart, you may learn my article on creating a Helm chart for steering. I created a Helm chart named nginx and created a namespace to put in my chart into utilizing the instructions beneath.

Create a namespace:

$ kubectl create ns nginx

Install the chart in your new namespace with a reputation:

$ helm set up chaos-pods nginx -n nginx

NAME: chaos-pods
LAST DEPLOYED: Sun May 23 10:15:52 2021
NAMESPACE: nginx
STATUS: deployed
REVISION: 1
NOTES:
1. Get the appliance URL by working these instructions:
  export POD_NAME=$(kubectl get pods --namespace nginx -l "app.kubernetes.io/name=nginx,app.kubernetes.io/instance=chaos-pods" -o jsonpath="")
  export CONTAINER_PORT=$(kubectl get pod --namespace nginx $POD_NAME -o jsonpath=".spec.containers[0].ports[0].containerPort")
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl --namespace nginx port-forward $POD_NAME 8080:$CONTAINER_PORT

Install Kube DOOM

You can use any Virtual Network Computer (VNC) viewer you need; I put in TigerVNC on my Linux field. There are a number of methods you may arrange Kube DOOM. Before I generated my Helm chart, you may set it up with kind or use it regionally with Docker, and the README incorporates directions for these makes use of.

Get began with a git clone:

$ git clone git@github.com:Alynder/kubedoom.git
Cloning into 'kubedoom'...

Then change listing into the kubedoom/helm folder:

$ cd kubedoom/helm/

Since the bottom values file is already arrange appropriately, you simply have to run a single set up command:

$ helm set up kubedoom kubedoom/ -n kubedoom
NAME: kubedoom
LAST DEPLOYED: Mon May 31 11:16:58 2021
NAMESPACE: kubedoom
STATUS: deployed
REVISION: 1
NOTES:
1. Get the appliance URL by working these instructions:
  export NODE_PORT=$(kubectl get --namespace kubedoom -o jsonpath="" companies kubedoom-kubedoom-chart)
  export NODE_IP=$(kubectl get nodes --namespace kubedoom -o jsonpath="")
  echo http://$NODE_IP:$NODE_PORT

Everything must be put in, arrange, and able to go.

Play with Kube DOOM

Now you simply have to get in there, run just a few instructions, and begin taking part in your new chaos online game. The first command is a port ahead, adopted by the VNC viewer connection command. The VNC viewer connection wants a password, which is idbehold.

Find your pod for the port ahead:

$ kubectl get pods -n kubedoom
NAME                                       READY   STATUS    RESTARTS   AGE
kubedoom-kubedoom-chart-676bcc5c9c-xkwpp   1/1     Running   zero          68m

Run the port-forward command utilizing your pod title:

$  kubectl port-forward  kubedoom-kubedoom-chart-676bcc5c9c-xkwpp 5900:5900 -n kubedoom
Forwarding from 127.zero.zero.1:5900 -> 5900
Forwarding from [::1]:5900 -> 5900

Everything is able to play, so that you simply have to run the VNC viewer command (proven beneath with output):

$  vncviewer viewer localhost:5900

TigerVNC Viewer 64-bit v1.10.1
Built on: 2020-04-09 06:49
Copyright (C) 1999-2019 TigerVNC Team and lots of others (see README.rst)
See https://www.tigervnc.org for info on TigerVNC.

Mon May 31 11:33:23 2021
 DecodeManager: Detected 64 CPU core(s)
 DecodeManager: Creating four decoder thread(s)
 CConn:       Connected to host localhost port 5900

Next, you will see the password request, so enter it (idbehold, as given above).

Once you’re logged in, you need to be capable to stroll round and see your enemies with pod names.

I am horrible at this sport, so I exploit some cheats to have a little bit extra enjoyable:

  • Type idspispopd to stroll straight by a wall to get to your military of pods.
  • Can’t deal with the gun? That’s cool; I am dangerous at it, too. If you kind idkfa and press the quantity 5, you will get a greater weapon.

This is what it appears to be like like once you kill one thing (I used k9s for this view).

Final notes

Because this software requires a cluster-admin position, it’s a must to actually take note of the names of the pods—you would possibly run right into a kube-system pod, and also you’d higher run away. If you kill a type of pods, you’ll kill an vital a part of the system.

I really like this software as a result of it is the quickest gamified method to do chaos engineering. It did remind me of how dangerous I used to be at this online game, but it surely was hilarious to attempt it. Happy looking!

Most Popular

To Top