Merge pull request #33 from javajon/master

Added katacoda scenario link. Some readme cleanup.
This commit is contained in:
Eugenio Marzo
2021-01-12 07:08:25 +01:00
committed by GitHub
+44 -34
View File
@@ -1,48 +1,56 @@
![Alt Text](https://github.com/lucky-sideburn/KubeInvaders/blob/master/logo.png)
*Gamified chaos engineering a analysis tool for Kubernetes. It is like Space Invaders but the aliens are PODs*
*Gamified chaos engineering an analysis tool for Kubernetes. It is like Space Invaders but the aliens are PODs.*
![Alt Text](https://github.com/lucky-sideburn/KubeInvaders/blob/master/images/kubeinvaders.png)
# Table of Contents
1. [Description](#Description)
2. [Special Input Keys and features](#Special-Input-Keys-and-features)
3. [Installation](#Installation)
4. [Notes For large clusters][#Notes-for-large-clusters]
4. [Notes for large clusters](#Notes-for-large-clusters)
5. [Configuration](#Configuration)
## Description
KubeInvaders has been developed using [Defold](https://www.defold.com/).
Through KubeInvaders you can stress Kubernetes cluster in a fun way and check how it is resilient.
Through KubeInvaders you can stress a Kubernetes cluster in a fun way and check how it is resilient.
I added also new experimental features like a linter for the pods. The current latest image of the game include [kube-linter](https://github.com/stackrox/kube-linter) developed by [stackrox](https://github.com/stackrox).
I added also new experimental features like a linter for the pods. The current latest image of the game include [kube-linter](https://github.com/stackrox/kube-linter) developed by [stackrox](https://github.com/stackrox)
## Special Input Keys and features
| Input | Action |
|-----------------|-------------------------------------------------------------------------------------------|
| n | Change namespace (you should define namespaces list. Ex: TARGET_NAMESPACE=foo1,foo2,foo3).|
| a | Switch to automatic mode. |
| m | Switch to manual mode. |
| h | Show special keys. |
| q | Hide help for special keys. |
| i | Show pod's name. Move the ship towards an alien. |
| r | Refresh log of a pod when spaceship is over the alien. |
| k | *(NEW)* Perform [kube-linter](https://github.com/stackrox/kube-linter) analisys for a pod |
| w | *(NEW)* Chaos engineering against kubernetes nodes |
| Input | Action |
|-----------------|--------------------------------------------------------------------------------------------|
| n | Change namespace (you should define namespaces list. Ex: TARGET_NAMESPACE=foo1,foo2,foo3). |
| a | Switch to automatic mode. |
| m | Switch to manual mode. |
| h | Show special keys. |
| q | Hide help for special keys. |
| i | Show pod's name. Move the ship towards an alien. |
| r | Refresh log of a pod when spaceship is over the alien. |
| k | *(NEW)* Perform [kube-linter](https://github.com/stackrox/kube-linter) analysis for a pod. |
| w | *(NEW)* Chaos engineering against Kubernetes nodes. |
### Known problems
It seems that Kubeinvaders does not work with EKS because of problems with ServiceAccount. Work in progress!
It seems that KubeInvaders does not work with EKS because of problems with ServiceAccount. Work in progress!
### Show logs of a pod
Move the spaceship over a white alien
Move the spaceship over a white alien.
## Hands-on Tutorial
To experience KubeInvaders in action, try it out in this free O'Reilly Katacoda scenario, [KubeInvaders](https://www.katacoda.com/kuber-ru/courses/kubernetes-chaos).
## Installation
### Install with HELM
```
### Install to Kubernetes with Helm (v3+)
```bash
# Set target_namespace and ingress.hostname!
git clone https://github.com/lucky-sideburn/KubeInvaders.git
@@ -52,9 +60,10 @@ helm install kubeinvaders --set-string target_namespace="namespace1\,namespace2"
--namespace kubeinvaders ./helm-charts/kubeinvaders \
--set ingress.hostName=kubeinvaders.io
```
### Install client on your workstation
The easiest way to install KubeInvaders is runing it on you workstation but if you choose this method you cannot use kube-linter feature directly from the game. Follow this guide:
The easiest way to install KubeInvaders is on your workstation but if you choose this method you cannot use kube-linter feature directly from the game. Follow this guide:
1. Start KubeInvaders docker container locally
@@ -62,8 +71,8 @@ The easiest way to install KubeInvaders is runing it on you workstation but if y
docker rm kubeinvaders -f && docker run --env DEVELOPMENT=true --env ENDPOINT=https://<k8s_url> --env NAMESPACE=namespace1,namespace2 --env TOKEN=<Service Account token> -p 8080:8080 --name kubeinvaders docker.io/luckysideburn/kubeinvaders
```
2. Create $HOME/.KubeInv.json like this - The endpoint is localhost:8080 because it is using Kubeinvaders container as proxy
to k8s
2. Create $HOME/.KubeInv.json like this - The endpoint is localhost:8080 because it is using KubeInvaders container as a proxy
to Kubernetes:
```json
{
@@ -74,21 +83,24 @@ to k8s
```
Download the game from these locations:
* [MacOS](https://github.com/lucky-sideburn/KubeInvaders/releases/download/chaos_node/x86_64-darwin.zip)
* [Linux](https://github.com/lucky-sideburn/KubeInvaders/releases/download/chaos_node/x86_64-linux.zip)
### Run directly form Docker
This method can be used for developing Kubeinvaders and testing the HTML5 bundle.
Using this method you can have problem of CORS.
### Run directly from Docker
This method can be used for developing KubeInvaders and testing the HTML5 bundle.
Using this method you can have problem of CORS:
```bash
docker build . -t kubeinvaders_dev
docker rm kubeinvaders -f && docker run --env DEVELOPMENT=true --env ENDPOINT=https://youk8scluster:8443 --env NAMESPACE=kubeinvadersdemo --env TOKEN=xxxx -p 8080:8080 --name kubeinvaders kubeinvaders_dev
```
### Install KubeInvaders on Openshift
To Install KubeInvaders on your Openshift Cluster clone this repo and launch the following commands:
### Install KubeInvaders on OpenShift
To Install KubeInvaders on your OpenShift Cluster clone this repo and launch the following commands:
```bash
oc create clusterrole kubeinvaders-role --verb=watch,get,delete,list --resource=pods,pods/log,jobs
@@ -116,10 +128,9 @@ oc process -f openshift/KubeInvaders.yaml -p ROUTE_HOST=$ROUTE_HOST -p TARGET_NA
![Alt Text](https://github.com/lucky-sideburn/KubeInvaders/blob/master/images/dcenv.png)
## Notes for large clusters
For cluster with many workers-nodes, Kubeinvaders selects a number of random items.
For clusters with many workers-nodes, KubeInvaders selects a subset of random items.
| Item | Max Number |
|-----------|--------------|
@@ -129,11 +140,10 @@ For cluster with many workers-nodes, Kubeinvaders selects a number of random ite
### Environment Variables - Make the game more difficult to win!
Set the following variables in Kubernetes Deployment or Openshift DeploymentConfig
Set the following variables in Kubernetes Deployment or OpenShift DeploymentConfig:
| ENV Var | Description |
|-----------------------------|-------------------------------------------------------------------------------|
| ALIENPROXIMITY (default 15) | Reduce the value to increase distance between aliens |
| HITSLIMIT (default 0) | Seconds of CPU time to wait before shooting |
| UPDATETIME (default 1) | Seconds to wait before update PODs status (you can set also 0.x Es: 0.5) |
| ALIENPROXIMITY (default 15) | Reduce the value to increase distance between aliens. |
| HITSLIMIT (default 0) | Seconds of CPU time to wait before shooting. |
| UPDATETIME (default 1) | Seconds to wait before update PODs status (you can set also 0.x Es: 0.5). |