Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

fivexl/kubernetes-events-to-slack

Repository files navigation

FivexL

K8S events to Slack streamer

Streams k8s events from k8s namespace to Slack channel as a Slack bot using incoming web hooks. No tokens needed.

Configuration

Configuration is done via env variables that you set in deployment or configmap.

  • K8S_EVENTS_STREAMER_INCOMING_WEB_HOOK_URL - Slack web hook URL where to send events. Mandatory parameter.
  • K8S_EVENTS_STREAMER_NAMESPACE - k8s namespace to collect events from. Will use be sending events from all namespaces if not specified
  • K8S_EVENTS_STREAMER_DEBUG - Enable debug print outs to the log. False if not defined. Set to True to enable.
  • K8S_EVENTS_STREAMER_SKIP_DELETE_EVENTS - Skip all events of type DELETED by setting env variable to True. False if not defined. Very useful since those events tells you that k8s event was deleted which has no value to you as operator.
  • K8S_EVENTS_STREAMER_LIST_OF_REASONS_TO_SKIP - Skip events based on their reason. Should contain list of reasons separated by spaces. Very useful since there are a lot of events that doesn't tell you much like image pulled or replica scaled. Send all events if not defined. Recommended reasons to skip 'Scheduled ScalingReplicaSet Pulling Pulled Created Started Killing SuccessfulMountVolume SuccessfulUnMountVolume. You can see more reasons here
  • K8S_EVENTS_STREAMER_USERS_TO_NOTIFY - Mention users on warning events, ex <@andrey9kin> <@slackbot>. Note! It is important that you use <> around user name. Read more here

Deployment

Intention is that you run streamer container in your k8s cluster. Take a look on example deployment yaml file

Or if you are a Terraform kind of person you can copy terraform example or use this repo as a module. Perhaps we should do a normal module out of it?

Docker Hub repo is here

Example message

Example