Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arska/chaosbutton
https://github.com/arska/chaosbutton
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/arska/chaosbutton
- Owner: arska
- Created: 2019-02-21T19:59:40.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-22T06:24:36.000Z (6 months ago)
- Last Synced: 2024-05-22T08:55:45.147Z (6 months ago)
- Language: Python
- Size: 599 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Chaosbutton
![Chaosbutton in action](images/chaosbutton.jpg)A large red button connected to a Raspberry Pi bringing chaos and mayhem to your
kubernetes-based service by killing a pod by random## How to create an OpenShift service account with a token that does not expire
```
oc create sa chaosbutton
oc policy add-role-to-user edit -z chaosbutton
oc describe sa chaosbutton | grep "Tokens:"
# get the secret name of the "Token"
oc describe secret chaosbutton-token-asd42 | grep "token:"
# copy the token and use below
```
## How to install on Raspberry Pi
```
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo deb http://apt.kubernetes.io/ kubernetes-stretch main > /etc/apt/sources.list.d/kubernetes.list
apt-get update
apt-get install git python3-pip kubectl
pip3 install RPi.GPIO kubernetes
git clone https://github.com/arska/chaosbutton.git
cd chaosbutton
kubectl config set-cluster appuio --server='https://api.cloudscale-lpg-2.appuio.cloud:6443'
kubectl config set-credentials appuio --token='kjhbmjhvbnbvnbv' # get a valid token e.g. above
kubectl config set-context appuio --cluster=appuio --user=appuio
kubectl config use-context appuio
python3 app.py
```
# To install the systemd service to start at boot
```
cp chaosbutton.service /lib/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable chaosbutton.service
```# How to I configure which pod gets killed?
See "namespace" and "selector" constants in app.py.namespace: the Kubernetes namespace (orr OpenShift project) name you want to operate in
selector: is the `label=value` from which one pod is selected by random, used as a
filter to query the Kubernetes API# How do I build the Button and the Raspberry pi?
I ordered my button locally in Switzerland from https://www.bastelgarage.ch/buzzer-taster-rot because it was the cheapest delivered to me.By default this application uses pin 15 (see "channel" in app.py) on the raspberry pi
IO header because pin 17 next to it has +3.3v power. connecting these to pins
together using the button is used as a trigger to kill one pod.