Unit
Unit
describes a task that must
execute periodically and should succeed every time.Use generic concepts to represent your supervision
Unit
Unit
describes a task that must
execute periodically and should succeed every time.Reactor
This is where the logic happens. A Reactor
describes what should happen after
the execution of a Unit.
The execution of a Reactor
can be triggered by the following events:
Unit
execution was successfulUnit
execution failedUnit
execution was successful while the previous one failedUnit
execution failed while the previous one was successfulInhibitor
An Inhibitor
describes when the execution of a Unit
should be skipped, ie:
Kubirds is distributed as a Kubernetes Operator and, as such, will require a working Kubernetes Cluster.
In the next part of this guide, we will assume that your cluster is up and
running, and that kubectl
is properly configured.
Kubirds is cloud-agnostic, meaning it will work flawlessly on any cloud provider, such as:
NB: This guide describes the installation method for the Freemium version of Kubirds. If you are interested by the complete version, please contact us.
In this guide, we will install Kubirds in the monitoring-system
namespace, feel free to change it to your preferences. To create the namespace,
run the command below:
kubectl create namespace monitoring-system
Kubirds relies on other technologies to implement the supervision behavior.
In the next part of this guide, we will set up those dependencies.
NB: The installation procedures for those dependencies described here are only one of many.
These instructions will help you deploy Kubirds on a brand new Kubernetes cluster.
If you already deployed those components, you can skip to the next part of this guide.
TektonCD is a Cloud Native CI/CD solution. Kubirds relies on it to build and run your supervision pipelines.
There are currently 2 methods to deploy TektonCD:
To install the core component of Tekton, Tekton Pipelines, run the command below:
kubectl apply -f "https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml"
It may take a few moments before the installation completes. You can check the progress with the following command:
kubectl get pods --namespace tekton-pipelines
Confirm that every component listed has the status Running
.
NB: TektonCD is composed of 3 components:
- Tekton Pipelines: define and execute Tasks and Pipelines
- Tekton Triggers: listen for events, and trigger the execution of Tasks and Pipelines
- Tekton Dashboard: visualize your tasks and pipelines
Kubirds only needs Tekton Pipelines, but feel free to deploy the other components as well.
First, install the operator with the following command:
kubectl apply -f "https://storage.googleapis.com/tekton-releases/operator/latest/release.yaml"
Then, create the following resource to deploy the Tekton components:
---
apiVersion: operator.tekton.dev/v1alpha1
kind: TektonConfig
metadata:
name: config
spec:
profile: lite
targetNamespace: pipeline-system
There are 3 profiles availables:
Kubirds is deployed through an Helm Chart.
Deploy the Helm Chart by running the following commands:
helm repo add link-society-incubator "https://charts.link-society.com/incubator"
helm repo update
helm upgrade --install \
kubirds link-society-incubator/kubirds \
--namespace monitoring-system \
--wait
NB: For more information about the chart options, read this document.
In this example, we'll set up monitoring for this website.
We want to verify that the website is accessible, and be notified on Slack as soon as it's not the case.
We'll perform a simple curl
every 5 minutes in a Unit
and trigger a
Reactor
when things go bad, and once they are back to normal.
In order to schedule the curl
command every 5 minutes, we'll use the
curlimages/curl:latest
Docker image.
Create the following resource on your Kubernetes cluster:
---
apiVersion: kubirds.com/v1
kind: Unit
metadata:
name: check-kubirds-access
namespace: default
labels:
app: kubirds-www
spec:
schedule: every 5 minutes
image:
name: curlimages/curl:latest
pullPolicy: Always
command: >
curl -L -v $HOST
env:
- name: HOST
value: https://kubirds.com
Now, we want to notify a Slack channel. Make sure you created a Slack Webhook.
Once your Slack Webhook is created, create a secret on your Kubernetes cluster containing its URL, for example:
---
apiVersion: v1
kind: Secret
metadata:
name: my-slack-webhook
namespace: default
stringData:
URL: "<YOUR WEBHOOK URL>"
In order to notify Slack, we'll also use curl
to push the notification.
Create the following resource on your Kubernetes cluster:
---
apiVersion: kubirds.com/v1
kind: Reactor
metadata:
name: slack-notifier
namespace: default
spec:
unitSelector:
app: kubirds-www
triggers:
success: no
failure: no
fixed: yes
regression: yes
image:
name: curlimages/curl:latest
pullPolicy: Always
command: >
curl -X POST $HOST -H "Content-Type: application/json" \
-d "{ \"text\": \"$UNIT_NAME reported state $UNIT_STATE\" }"
env:
- name: HOST
valueFrom:
secretKeyRef:
name: my-slack-webhook
key: URL
Once the site is down, you'll receive the following notification on Slack:
And once it's back to normal:
Kubirds comes with a lot of integrations with other systems out of the box. Those will help you build your supervision with ease.
If you wish to dive deeper into Kubirds features and inner workings, please consult the Documentation.