• This repository has been archived on 11/Jan/2021
  • Stars
    star
    323
  • Rank 130,051 (Top 3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 8 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Kubernetes Slack Monitoring

kube-slack

kube-slack is a monitoring service for Kubernetes. When a pod has failed, it will publish a message in Slack channel.

Screenshot

Installation

A Helm chart is available

  1. Create an incoming webhook:
    1. In the Slack interface, click on the gears button (Channel Settings) near the search box.
    2. Select "Add an app or integration"
    3. Search for "Incoming WebHooks"
    4. Click on "Add configuration"
    5. Select the channel you want the bot to post to and submit.
    6. You can customize the icon and name if you want.
    7. Take note of the "Webhook URL". This will be something like https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
  2. (optional) If your kubernetes uses RBAC, you should apply the following manifest as well:
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: kube-slack
rules:
- apiGroups: [""]
  resources: ["pods"]
  verbs: ["get", "watch", "list"]
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: kube-slack
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: kube-slack
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: kube-slack
subjects:
  - kind: ServiceAccount
    name: kube-slack
    namespace: kube-system

Load this Deployment into your Kubernetes. Make sure you set SLACK_URL to the Webhook URL and uncomment serviceAccountName if you use RBAC

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: kube-slack
  namespace: kube-system
spec:
  replicas: 1
  revisionHistoryLimit: 3
  template:
    metadata:
      annotations:
        scheduler.alpha.kubernetes.io/critical-pod: ""
      name: kube-slack
      labels:
        app: kube-slack
    spec:
     # Uncomment serviceAccountName if you use RBAC.
     # serviceAccountName: kube-slack
      containers:
      - name: kube-slack
        image: willwill/kube-slack:v4.2.0
        env:
        - name: SLACK_URL
          value: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
        resources:
          requests:
            memory: 30M
            cpu: 5m
      tolerations:
      - effect: NoSchedule
        key: node-role.kubernetes.io/master
      - key: CriticalAddonsOnly
        operator: Exists
  1. To test, try creating a failing pod. The bot should announce in the channel after 15s with the status ErrImagePull. Example of failing image:
apiVersion: v1
kind: Pod
metadata:
  name: kube-slack-test
spec:
  containers:
  - image: willwill/inexisting
    name: kube-slack-test

Additionally, the following environment variables can be used:

  • TICK_RATE: How often to update in milliseconds. (Default to 15000 or 15s)
  • FLOOD_EXPIRE: Repeat notification after this many milliseconds has passed after status returned to normal. (Default to 60000 or 60s)
  • NOT_READY_MIN_TIME: Time to wait after pod become not ready before notifying. (Default to 60000 or 60s)
  • METRICS_CPU: Enable/disable metric alerting on cpu (Default true)
  • METRICS_MEMORY: Enable/disable metric alerting on memory (Default true)
  • METRICS_PERCENT: Set percentage threshold on metric alerts (Default 80)
  • METRICS_REQUESTS: If no metrics limit defined, alert if the pod utilization is more than the resource request amount (this may be very noisy, Default false).
  • KUBE_USE_KUBECONFIG: Read Kubernetes credentials from active context in ~/.kube/config (default off)
  • KUBE_USE_CLUSTER: Read Kubernetes credentials from pod (default on)
  • KUBE_NAMESPACES_ONLY: Monitor a list of specific namespaces, specified either as json array or as a string of comma seperated values (foo_namespace,bar_namespace).
  • SLACK_CHANNEL: Override channel to send
  • SLACK_USERNAME: Override username to send
  • SLACK_PROXY: URL of HTTP proxy used to connect to Slack
  • RECOVERY_ALERT: Set to false to disable alert on pod recovery

Annotations

Pods can be marked with the following annotations:

  • kube-slack/ignore-pod: Ignore all errors from this pod
  • kube-slack/slack-channel: Name of slack channel to notify (eg. #monitoring)

License

MIT License

More Repositories

1

xds

Simple xDS server for Kubernetes
Go
110
star
2

wongnai-corpus

Collection of Wongnai's datasets
75
star
3

eastern

Simple Kubernetes Deployment
Python
26
star
4

thumbor-text-filter

Add custom text to image with Thumbor filter
Python
15
star
5

docker-spark-standalone

Spark Standalone (on Docker)
Shell
9
star
6

docker-tomcat-nginx

Tomcat with Nginx (on Docker).
Shell
7
star
7

get-location-with-timeout

Wrapper for navigator.geolocation.getCurrentPosition with ensure rejected the promise when timeout
TypeScript
7
star
8

version-pong

Publish NPM package and automated bump version in the package.json based on Standard Version.
TypeScript
5
star
9

RestService

A wrapper around requestjs to attach unique parameter of each client request.
JavaScript
4
star
10

docker-grpcui

Docker image for https://github.com/fullstorydev/grpcui
Dockerfile
4
star
11

nginx-telegraf-accesslog-docker

NGINX with telegraf-ready access log as docker image
Nginx
3
star
12

imagecleanup

Cleanup unused Docker images
Rust
2
star
13

rollup-plugin-data-qa

rollup plugin for inject data-qa atts to react-dom
TypeScript
2
star
14

source-replacement

Module to enhance ability of source replacement for website
TypeScript
2
star
15

opentracing-xray

Open tracing using AWS X-Ray
Java
1
star
16

jenkins-slave-docker

Jenkins slave as Docker
Shell
1
star
17

docker-odoo-openupgrade

Base docker image for Odoo OpenUpgrade
Shell
1
star
18

relation-data-exporter

Data Exporter for Relational Database used at Wongnai.
Java
1
star
19

docker-php

PHP (on Docker) with required libraries using at Wongnai.
1
star
20

workspace-ldap

LDAP server with data from Google Workspace
Go
1
star
21

docker-apache-atlas

Containerized Apache Atlas
Dockerfile
1
star
22

safetynet

Go SafetyNet JWS validation
Go
1
star
23

with-mobx-store

HOC library for MobX Provider wrapping.
JavaScript
1
star
24

tonkatsu-amp

TypeScript
1
star