-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add doc index and improve installation with helm support #173
base: main
Are you sure you want to change the base?
Changes from all commits
3af401f
d73d60c
e9ee9da
ef308c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# Consume cerberus signal | ||
|
||
Various examples on how to comsume the Cerberus signal : | ||
|
||
- Using a simple http client (cURL) | ||
- As an init container for a Pod | ||
- As a tekton task (part of a pipeline) | ||
|
||
## Simple check with curl | ||
|
||
if you just want to check the cerberus signal, you can use this small script to check the cerberus signal. | ||
|
||
```bash | ||
export CERBERUS_URL=http://cerberus.chaos-cerberus.svc.cluster.local:8080 | ||
if curl -s "$CERBERUS_URL" | grep True &> /dev/null; then | ||
echo "Cerberus check is OK at ${CERBERUS_URL}" | ||
else | ||
echo "Cerberus check is NOT OK at ${CERBERUS_URL}" | ||
fi | ||
``` | ||
|
||
## As an init container | ||
|
||
This example allow you to start a container when cerberus return a OK signal. | ||
|
||
```yaml | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: cerberus-config-job | ||
data: | ||
cerberus_url: "cerberus.default.svc.cluster.local" | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: "check-node-if-cerberus-ok" | ||
spec: | ||
template: | ||
spec: | ||
initContainers: | ||
- name: check-cerberus | ||
image: quay.io/startx/runner-oc:fc35 | ||
command: ['bash', '-c', "until curl -s $CERBERUS_URL | grep True &> /dev/null; do echo Wait for OK from cerberus at $CERBERUS_URL; sleep 2; done"] | ||
env: | ||
- name: CERBERUS_URL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: cerberus-config-job | ||
key: cerberus_url | ||
containers: | ||
- name: job-task | ||
image: "quay.io/startx/runner-oc:fc35" | ||
command: | ||
- "/bin/bash" | ||
- "-c" | ||
- |- | ||
echo "executed after a POSITIVE cerberus check agains't $CERBERUS_URL" | ||
echo "Replace this container definition with your own description" | ||
exit | ||
env: | ||
- name: CERBERUS_URL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: cerberus-config-job | ||
key: cerberus_url | ||
resources: | ||
requests: | ||
cpu: "10m" | ||
memory: "64Mi" | ||
limits: | ||
cpu: "50m" | ||
memory: "128Mi" | ||
restartPolicy: Never | ||
backoffLimit: 2 | ||
``` | ||
|
||
## Using tekton pipeline | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @startx-lab thoughts on creating a new section called use cases/Cerberus in practice and moving the content over there similar to how you did for Kraken: krkn-chaos/krkn#333? |
||
|
||
You can find on [artifacthub.io](https://artifacthub.io/packages/search?kind=7&ts_query_web=cerberus) the | ||
[cerberus-check](https://artifacthub.io/packages/tekton-task/startx-tekton-catalog/cerberus-check) `tekton-task` | ||
which can be used to check a cerberus signal (and a cluster global health) as part of a chaos pipeline. | ||
You can read [tekton concepts](https://tekton.dev/docs/concepts/overview/), [tekton pipeline entities](https://github.com/tektoncd/pipeline/blob/main/docs/README.md#tekton-pipelines-entities), [tekton getting started](https://tekton.dev/docs/getting-started/tasks/) and the | ||
[openshift pipeline documentation](https://docs.openshift.com/container-platform/4.10/cicd/pipelines/understanding-openshift-pipelines.html) | ||
to get familiar with this project. | ||
|
||
### Installing tekton | ||
|
||
#### OpenShift cluster | ||
|
||
To use this task, you must have tekton enabled into your cluster. For Openshift cluster, an operator named **Openshift pipeline** enable tekton in your cluster. You can use the OperatorHub to find the `Openshift pipeline` operator and deploy it in your openshift cluster. You can also use [startx helm-chart pipeline](https://helm-repository.readthedocs.io/en/latest/charts/cluster-pipeline/) for easy and automatic install. | ||
|
||
#### Kubernetes cluster | ||
|
||
```bash | ||
kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml | ||
kubectl get pods --namespace tekton-pipelines --watch | ||
``` | ||
|
||
### Running cerberus tekton task | ||
|
||
#### Start as a single taskrun | ||
|
||
```bash | ||
kubectl project default | ||
kubectl apply -f https://github.com/startxfr/tekton-catalog/raw/stable/task/cerberus-check/0.1/samples/taskrun.yaml | ||
kubectl get taskrun pod | ||
``` | ||
|
||
#### Start as a pipelinerun | ||
|
||
```bash | ||
kubectl project default | ||
kubectl apply -f https://github.com/startxfr/tekton-catalog/raw/stable/task/cerberus-check/0.1/samples/pipelinerun.yaml | ||
kubectl get pipelinerun taskrun pod | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Cerberus watchdog Guide | ||
|
||
## Table of Contents | ||
- [Cerberus watchdog Guide](#cerberus-watchdog-guide) | ||
- [Table of Contents](#table-of-contents) | ||
- [Introduction](#introduction) | ||
- [Tooling](#tooling) | ||
- [Workflow](#workflow) | ||
|
||
## Introduction | ||
|
||
One keypoint of a chaos infrastructure test is the way to obtain a reliable status of the health of your targeted cluster. | ||
Cerberus is that master piece component that observe regulary various central components of your targeted cluster and return an updated | ||
signal of the global health of you cluster. | ||
|
||
For more detail about chaos challenges, read the [cerberus introduction to chaos testing](https://github.com/chaos-kubox/krkn/blob/main/docs/index.md#introduction) | ||
|
||
## Tooling | ||
|
||
In this section, we will go through how [cerberus](https://github.com/chaos-kubox/cerberus) - a cluster watchdog can help test the global health state of OpenShift and make sure you track state change and return an updated global health signal. | ||
|
||
## Workflow | ||
|
||
Let us start by understanding the workflow of Cerberus: the user will start by running cerberus by pointing to a specific OpenShift cluster using kubeconfig to be able to talk to the platform on top of which the OpenShift cluster is hosted. This can be done by either the oc/kubectl API or the cloud API. Based on the configuration of cerberus, it will [watch for nodes](https://github.com/startxfr/cerberus/blob/main/docs/config.md#watch-nodes), | ||
[watch for cluster operators](https://github.com/startxfr/cerberus/blob/main/docs/config.md#watch-cluster-operators), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a list here of components that cerberus can watch. Could you update that check box list with the links to the docs/config section for each? Please be sure to add the link to the main chaos-kubox repo not your own thanks |
||
[watch for master schedulable status](https://github.com/startxfr/cerberus/blob/main/docs/config.md#watch-master-schedulable-status), | ||
[watch for defined namespaces](https://github.com/startxfr/cerberus/blob/main/docs/config.md#watch-namespaces) and | ||
[watch for defined routes](https://github.com/startxfr/cerberus/blob/main/docs/config.md#watch-routes). | ||
Accoridng to the result of theses check, cerberus will return a go/no-go signal representing the overall health of the cluster. | ||
|
||
![Cerberus workflow](../media/cerberus-workflow.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets use a link to another doc like this:
../docs/installation.md#run-in-kubernetesopenshift