With the massive adoption of Kubernetes and the fact the continuous delivery has become a standard practice, the rollout of new versions is now more automated than ever. But what happens if you deploy a faulty version? How much time and effort it will take to rollback to the previous, non-faulty version?

kuberbs (Kubernetes Rollback System) is an attempt to solve this problem by monitoring your Kubernetes deployments and if your error rate (user-defined metrics) is above a threshold then the deployment will be rolled back to the previous version.

Right now, kuberbs supports Stackdriver and Datadog metrics as an indicator of error-rate. We are also planning to add more integrations with other monitoring systems as well.

kuberbs is written in Go and it is running as a pod inside your GKE cluster’s kube-system namespace without any modification to the cluster itself.

kuberbs uses CRD (Custom Resource Definition) and acts as Operator to manage the configuration which deployments to monitor, what are the metrics and what are the thresholds.

apiVersion: "doit-intl.com/v1"

kind: Rbs

metadata:

name: my-rbs-example

spec:

watchperiod: 5

metricssource: stackdriver

namespaces:

- name: default

deployments:

- deployment:

name: hello-kubernetes-app

#Stack driver metric

metric: logging.googleapis.com/user/hello-kubernetes-app-errors

threshold: 1

- deployment:

name: kubernetes-app-2

# DataDog metric

metric: gcp.container.cpu.usage_time{*}

threshold: 85

- name: kube-system

deployments:

- deployment:

name: kube-dns

metric: logging.googleapis.com/user/dig

threshold: 30

The configuration is done via environment variables which are exposed in a kuberbs’s ConfigMap.

apiVersion: v1

data:

KUBERBS_CHECKMETRICSINTERVAL: "10"

KUBERBS_APIKEY: ""

KUBERBS_APPKEY: ""

KUBERBS_DEBUG: "false"

kind: ConfigMap

metadata:

labels:

app: kuberbs

name: kuberbs-config

namespace: kube-system

You can see KubeRBS in action in this short video:

It’s still early days for kuberbs and we have big plans for it. If you’d like to be involved and contribute, we are actively seeking for contributors to help us to improve it and cover more use-cases.

Want more stories? Check our blog on Medium, or follow Aviv on Twitter.