Eugenio Marzo c729dccc69 fix
2020-12-26 22:15:21 +01:00
fix
2020-12-26 15:01:38 +01:00
2019-03-29 11:14:41 +01:00
2020-05-28 06:30:43 +00:00
2020-05-24 08:28:44 +02:00
2020-12-26 12:44:43 +01:00
2020-12-26 12:44:43 +01:00
fix
2020-12-26 22:15:21 +01:00
fix
2020-12-26 22:15:21 +01:00
2019-10-25 16:35:08 -04:00
2020-12-26 12:44:43 +01:00
2019-10-27 09:54:51 +01:00
2019-04-21 22:02:31 +02:00
2019-04-21 23:29:46 +02:00
2019-03-31 11:55:28 +02:00
2019-10-31 11:36:48 +09:00
2020-12-26 12:44:43 +01:00
fix
2020-12-26 22:15:21 +01:00
2019-09-13 09:57:49 +02:00
2019-03-31 11:55:28 +02:00
2019-04-21 23:31:07 +02:00
2020-05-24 08:39:01 +02:00
fix
2020-12-26 14:56:21 +01:00
2020-12-26 12:44:43 +01:00
fix
2020-12-26 22:15:21 +01:00

Alt Text

Gamified chaos engineering tool for Kubernetes. It is like Space Invaders but the aliens are PODs

Alt Text

Table of Contents

  1. Description
  2. Special Input Keys and features
  3. Installation
  4. Developing
  5. 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.

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.

Show logs of a pod

Move the spaceship over a white alien

Installation

Run Directly from Docker

Suggested for development purpose in order to test HTML build.

docker run --env DEVELOPMENT=true --env ROUTE_HOST=myocpcluster:8443 --env NAMESPACE=kubeinvaders --env ALIENPROXIMITY=15 --env HITSLIMIT=0  --env UPDATETIME=0.5 --env TOKEN=<my service account or user token>  --env KUBERNETES_SERVICE_PORT_HTTPS=8443 --env KUBERNETES_SERVICE_HOST=myocpcluster -p 8080:8080 --name kubeinvaders docker.io/luckysideburn/kubeinvaders:latest

go to http://localhost.8080

Install with HELM

# Set target_namespace and ingress.hostname!
git clone https://github.com/lucky-sideburn/KubeInvaders.git

kubectl create namespace kubeinvaders

helm install kubeinvaders --set-string target_namespace="namespace1\,namespace2" \
--namespace kubeinvaders ./helm-charts/kubeinvaders \
--set ingress.hostName=kubeinvaders.io

Install KubeInvaders on Openshift

To Install KubeInvaders on your Openshift Cluster clone this repo and launch the following commands:

oc create clusterrole kubeinvaders-role --verb=watch,get,delete,list --resource=pods,pods/log

TARGET_NAMESPACE=foobar,awesome-namespace
## You can define multiple namespaces ex: TARGET_NAMESPACE=foobar,foobar2

# Choose route host for your kubeinvaders instance.
ROUTE_HOST=kubeinvaders.org

# Please add your source ip IP_WHITELIST. This will add haproxy.router.openshift.io/ip_whitelist in KubeInvaders route
# https://docs.openshift.com/container-platform/3.9/architecture/networking/routes.html#whitelist
IP_WHITELIST="93.44.96.4"

oc new-project kubeinvaders --display-name='KubeInvaders'
oc create sa kubeinvaders -n kubeinvaders
oc adm policy add-cluster-role-to-user kubeinvaders-role -z kubeinvaders -n kubeinvaders

KUBEINVADERS_SECRET=$(oc get secret -n kubeinvaders --field-selector=type==kubernetes.io/service-account-token | grep 'kubeinvaders-token' | awk '{ print $1}' | head -n 1)

oc process -f openshift/KubeInvaders.yaml -p ROUTE_HOST=$ROUTE_HOST -p TARGET_NAMESPACE=$TARGET_NAMESPACE -p KUBEINVADERS_SECRET=$KUBEINVADERS_SECRET | oc create -f -

How the configuration of KubeInvaders DeploymentConfig should be (remember to use your TARGET_NAMESPACE and ROUTE_HOST)

Alt Text

Developing

Develop HTML5 application whit Defold and Docker

  1. (Defold) Go to Project => Bundle => HTML5 Application
  2. Copy the js-web folder inside the root of KubeInvaders project
  3. docker build . -t docker.io/luckysideburn/kubeinvaders:foo
  4. Run with this
docker run --env DEVELOPMENT=true --env ROUTE_HOST=myocpcluster:8443 --env NAMESPACE=kubeinvaders --env ALIENPROXIMITY=15 --env HITSLIMIT=0  --env UPDATETIME=0.5 --env TOKEN=<my service account or user token>  --env KUBERNETES_SERVICE_PORT_HTTPS=8443 --env KUBERNETES_SERVICE_HOST=myocpcluster -p 8080:8080 --name kubeinvaders docker.io/luckysideburn/kubeinvaders:foo
  1. go to http://localhost.8080

Configuration

Environment Variables - Make the game more difficult to win!

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)
Languages
JavaScript 39.1%
HTML 20.6%
Python 17.1%
Lua 15.8%
Shell 3.5%
Other 3.9%