All Projects → hootsuite → Sens8

hootsuite / Sens8

Licence: other
Kubernetes controller for Sensu checks

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Sens8

Cronjobber
Cronjobber is a cronjob controller for Kubernetes with support for time zones
Stars: ✭ 169 (+302.38%)
Mutual labels:  k8s, kubernetes-operator, kubernetes-controller
kotary
Managing Kubernetes Quota with confidence
Stars: ✭ 85 (+102.38%)
Mutual labels:  k8s, kubernetes-operator, kubernetes-controller
Bonny
The Elixir based Kubernetes Development Framework
Stars: ✭ 190 (+352.38%)
Mutual labels:  k8s, kubernetes-operator, kubernetes-controller
K8gb
A cloud native Kubernetes Global Balancer
Stars: ✭ 113 (+169.05%)
Mutual labels:  k8s, kubernetes-operator, kubernetes-controller
Rbacsync
Automatically sync groups into Kubernetes RBAC
Stars: ✭ 197 (+369.05%)
Mutual labels:  k8s, kubernetes-operator, kubernetes-controller
aws-cloud-map-mcs-controller-for-k8s
K8s controller implementing Multi-Cluster Services API based on AWS Cloud Map.
Stars: ✭ 61 (+45.24%)
Mutual labels:  k8s, kubernetes-controller
mloperator
Machine Learning Operator & Controller for Kubernetes
Stars: ✭ 85 (+102.38%)
Mutual labels:  k8s, kubernetes-operator
grafana-operator
An operator for Grafana that installs and manages Grafana instances, Dashboards and Datasources through Kubernetes/OpenShift CRs
Stars: ✭ 449 (+969.05%)
Mutual labels:  k8s, kubernetes-operator
wordpress-operator
Bitpoke Kubernetes operator for WordPress
Stars: ✭ 159 (+278.57%)
Mutual labels:  kubernetes-operator, kubernetes-controller
vault-sidecar-injector
Kubernetes admission webhook for secure, seamless and dynamic handling of secrets in your applications
Stars: ✭ 55 (+30.95%)
Mutual labels:  k8s, kubernetes-controller
kubereplay
Seamless integration of goReplay and Kubernetes
Stars: ✭ 30 (-28.57%)
Mutual labels:  kubernetes-operator, kubernetes-controller
siddhi-operator
Operator allows you to run stream processing logic directly on a Kubernetes cluster
Stars: ✭ 16 (-61.9%)
Mutual labels:  k8s, kubernetes-operator
mysql-operator
Asynchronous MySQL Replication on Kubernetes using Percona Server and Openark's Orchestrator.
Stars: ✭ 810 (+1828.57%)
Mutual labels:  kubernetes-operator, kubernetes-controller
td-redis-operator
一款强大的云原生redis-operator,经过大规模生产级运行考验,支持分布式集群、支持主备切换等缓存集群解决方案…The powerful cloud-native redis-operator, which has passed the test of large-scale production-level operation, supports distributed clusters and active/standby switching ...
Stars: ✭ 327 (+678.57%)
Mutual labels:  k8s, kubernetes-operator
Kudo
Kubernetes Universal Declarative Operator (KUDO)
Stars: ✭ 849 (+1921.43%)
Mutual labels:  kubernetes-operator, kubernetes-controller
cdap-operator
CDAP Kubernetes Operator
Stars: ✭ 17 (-59.52%)
Mutual labels:  kubernetes-operator, kubernetes-controller
rabbitmq-operator
RabbitMQ Kubernetes operator
Stars: ✭ 16 (-61.9%)
Mutual labels:  k8s, kubernetes-operator
aws-iam-operator
AWS IAM Operator for Kubernetes
Stars: ✭ 23 (-45.24%)
Mutual labels:  kubernetes-operator, kubernetes-controller
port-map-operator
LoadBalancer Service type implementation for home Kubernetes clusters via Port Control Protocol.
Stars: ✭ 25 (-40.48%)
Mutual labels:  kubernetes-operator, kubernetes-controller
Airflow Operator
Kubernetes custom controller and CRDs to managing Airflow
Stars: ✭ 278 (+561.9%)
Mutual labels:  kubernetes-operator, kubernetes-controller
sens8

Sensu + K8s

CircleCI

A Kubernetes controller that watches cluster resources (Deployment, Pod etc.) and runs Sensu checks which are declared in the resource's annotations. For each of the check definitions it will run them at the specified interval, updating the checks with the latest resource info provided by Kubernetes. It communicates directly to Sensu's RabbitMQ endpoint, dynamically adding Sensu proxy clients and optionally removing them on resource deletion or annotation update.

Sens8 effectively acts a Sensu super client. It allows for checks to be run on ephemeral resources such as a pod under a replicaset without having to sidecar the heavy Sensu ruby client, or restart it. By having checks defined in the resources themselves it gives teams greater autonomy and lets checks be pushed out via CD. It also prevents having to manage resource-level checks out of band via configuration management.

Unlike a traditional setup where Sensu's client is installed with check scripts, only a predefined number of checks are supported (i.e., only check definitions are allowed in the annotations). Refer to the check command documentation for what is valid for each resource. Most checks are intended to be run over the network - like making an http request to a pod. For resources such as deployments, only checks based on the status provided by Kubernetes are possible.

A keepalive is run for Sens8 itself, and only itself, since all other checks register under proxy clients. Given its super client nature it's advised to set up alerting/paging appropriately.

Build

make all

Deployment

Refer to kubernetes.yml for an example deployment + config

Limitations

  • Only RabbitMQ transport is supported (no Redis)
  • If Sens8 crashes, all checks that have a ttl will alert
  • Subscriptions are ignored
  • Only checks are run. No metrics
  • Certain resources types such Deployment have a limited feature set and only alert of the status provided by Kubernetes.

Roadmap

See projects for status

Check Schema

Checks are defined in the annotation hootsuite.com/sensu-checks of a given resource as a json array check objects. The check format is same as Sensu's check configuration minus some fields being ignored. Refer to Sensu's check definition specification as a guide.

field type required example description
name string * my_check Name of the check. Must be unique to the resource it's running on. See Sensu's check naming
command string * deployment_status --warn 0.9 --crit 0.8 Check to run. The first chunk of the string is the check id. All other parameters get parsed by the check itself. Environment variables and backticks (sub-shells) are interpolated. Refer to the check command documentation for valid checks that can be run on the given resource
interval int * 30 Interval in seconds between checks
deregister bool true Deregister the proxy client sensu on resource deletion or annotation removal. Default value is dependant on resource type. Pod: true, Deployment: false

All other (arbitrary) fields get passed along with the check result in the same way Sensu client proper does.

Check results will be registered/de-registered with the following template:

Resource Source (client name) Deregister default
Deployment deployment-name.deployment.namespace false
Pod pod-name.pod.namespace true
Service sevice-name.service.namespace false
ReplicaSet replicatset-name.replicatset.namespace false
Node node-name.node.namespace false
DaemonSet daemonSet-name.daemonSet.namespace false

Example check annotation

[
  {
    "name": "deployment_status",
    "command": "deployment_status --warn 0.9 --crit 0.8",
    "interval": 60,
    "deregister": true,
    "foo": "bar"
  }
]

Example check result

For the given check example above, the check result to Sensu might look like:

[
  {
    "name": "deployment_status",
    "command": "deployment_status --warn 0.9 --crit 0.8",
    "interval": 60,
    "deregister": true,
    "foo": "bar",
    "source": "test-app.deployment.default",
    "status": 0,
    "output": "replicas: 5, updatedReplicas: 5, unavailableReplicas: 0"
  }
]

Defaults

It is possible to set defaults for all checks in Sens8's -config-file config. Arbitrary fields are respected, but any field defined in the check will override it. It is also possible to set a default for the required interval. Example:

{
  "defaults": {
    "interval": 60,
    "occurrences": 3,
    "refresh": 900,
    "handlers": ["default"],
    "pager_team": "production_engineering"
  }
}

Example service deployment

kind: Deployment
apiVersion: extensions/v1beta1
metadata:
  labels:
    app: test-app
  name: test-app
  namespace: default
  annotations:
    hootsuite.com/sensu-checks: |-
      [
        {
          "name": "deployment_status",
          "command": "deployment_status --warn 0.9 --crit 0.8",
          "interval": 60,
          "occurrences": 3,
          "refresh": 900,
          "handlers": ["default"],
          "pager_team": "production_engineering",
          "documentation": "http://example.com/runbook.html",
          "deregister": true
        }
      ]
spec:
  replicas: 1
  revisionHistoryLimit: 1
  selector:
    matchLabels:
      app: test-app
  template:
    metadata:
      labels:
        app: test-app
      annotations:
        hootsuite.com/sensu-checks: |-
          [
            {
              "name": "check_pod_dependencies",
              "command": "hs_healthcheck --url http://:::POD_IP::::80/status/dependencies",
              "interval": 60,
            }
          ]
    spec:
      containers:
      - name: test-app
        image: markeijsermans/debug
        command: ["python3"]
        args: ["-u", "-m", "http.server", "80"]
        imagePullPolicy: Always
        ports:
        - containerPort: 80
          protocol: TCP

Checks Commands

Each resource is limited to a subset of commands that can be run against it.

Check Command Documentation

or

Get latest docs via: ./sens8 -check-docs

Release Process

If master branch contains a git tag, circle-ci will tag the docker image as well. Make sure to push the tag, before the commit. This will likely change when circle-ci 2.0 supports git tags.

Maintainers

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].