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 medium configurations
  ## Resources you want to watch
  resources:
    - name: NAME_OF_THE_RESOURCE   # Name of the resources e.g pods, deployments, ingresses, etc. (Resource name must be in plural form)
      namespaces:                  # List of namespaces, "all" will watch all the namespaces
        - all
      events:                      # List of lifecycle events you want to receive, e.g create, update, delete, error OR all
        - create
        - delete
        - error
    - name: pods
      namespaces:
        - kube-system
      events:
        - create
        - delete
        - error

  # 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'
  
    # 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 
  
    # 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
  
  # 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 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:

  • pods
  • nodes
  • services
  • namespaces
  • replicationcontrollers
  • persistentvolumes
  • persistentvolumeclaims
  • secrets
  • configmaps
  • deployments
  • daemonsets
  • replicasets
  • ingresses
  • jobs
  • roles
  • rolebindings
  • clusterroles
  • clusterrolebindings

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.