Configuration

BotKube backend reads configurations from config.yaml file placed at CONFIG_PATH

config.yaml syntax

The configuration file contains,

  • Resource list you want to watch
  • The type of events you want to get notifications about
  • Way to skip filter runs
  • Communication mediums configuration
  • Toggle notification type to short or long
  ## Resources you want to watch
  resources:
    - name: NAME_OF_THE_RESOURCE         # Name of the resources e.g pod, deployment, ingress, etc. (Resource name must be in singular form)
      namespaces:         
        include:
          - all
        ignore:                          # List of namespaces to be ignored (omitempty), used only with include: all
          -                              # example : include [all], ignore [x,y,z]
      events:                            # List of lifecycle events you want to receive, e.g create, update, delete, error OR all
        - create
        - update
        - delete
        - error
    - name: pod
      namespaces:
        include:
          - dev
          - qa
          - default
        ignore:
          - kube-system
          - prod
      events:
        - all

  # Check true if you want to receive recommendations
  # about the best practices for the created resource
  recommendations: true
  
  # Communcation mediums configuration
  communications:
    # Settings for Slack
    slack:
      enabled: false
      channel: 'SLACK_CHANNEL'               # Slack channel name without '#' prefix where you have added BotKube and want to receive notifications in
      token: 'SLACK_API_TOKEN'
      notiftype: short                       # Change notification type short/long you want to receive. notiftype is optional and Default notification type is short (if not specified)

  
    # Settings for Mattermost
    mattermost:
      enabled: false
      url: 'MATTERMOST_SERVER_URL'           # URL where Mattermost is running. e.g https://example.com:9243
      token: 'MATTERMOST_TOKEN'              # Personal Access token generated by BotKube user
      team: 'MATTERMOST_TEAM'                # Mattermost Team to configure with BotKube 
      channel: 'MATTERMOST_CHANNEL'          # Mattermost Channel for receiving BotKube alerts 
      notiftype: short                       # Change notification type short/long you want to receive. notiftype is optional and Default notification type is short (if not specified)
  
    # Settings for ELS
    elasticsearch:
      enabled: false
      server: 'ELASTICSEARCH_ADDRESS'        # e.g https://example.com:9243
      username: 'ELASTICSEARCH_USERNAME'
      password: 'ELASTICSEARCH_PASSWORD'
      # ELS index settings
      index:
        name: botkube
        type: botkube-event
        shards: 1
        replicas: 0

    # Settings for Webhook
    webhook:
      enabled: false
      url: 'WEBHOOK_URL'                      # e.g https://example.com:80
  
  # Setting to support multiple clusters
  settings:
    # Cluster name to differentiate incoming messages
    clustername: not-configured
    # Set true to enable kubectl commands execution
    allowkubectl: false
    # Set true to enable config watcher
    configwatcher: true
    # Set false to disable upgrade notification
    upgradeNotifier: true

The default configuration can be found at:

For helm charts: https://github.com/infracloudio/botkube/blob/master/helm/botkube/values.yaml

For all-in-one deployment spec: https://github.com/infracloudio/botkube/blob/master/deploy-all-in-one.yaml

As of now, BotKube can watch following types of resources:

  • pod
  • node
  • service
  • namespace
  • replicationcontroller
  • persistentvolume
  • persistentvolumeclaim
  • secret
  • configmap
  • deployment
  • daemonset
  • replicaset
  • ingress
  • job
  • role
  • rolebinding
  • clusterrole
  • clusterrolebinding

Updating the configuration at runtime

You can update the configuration and use helm upgrade to update configuration values for the BotKube.

You can also change values directly in ConfigMap - which is not reccomended but is great for quick experimentation. You have to edit the configmap which will also restart the BotKube pod to update mounted configuration in the pod.

$ kubectl edit configmap botkube-configmap -n botkube

This command will open configmap specs in an editor. Do the required changes, save and exit. The BotKube pod will automatically restart to have these configuration in effect.