Slack

Install BotKube to the Slack workspace

Follow the steps below to install BotKube Slack app to your Slack workspace.

Install BotKube Slack app to your Slack workspace

Click the Add to Slack button provided to install BotKube Slack application to your workspace. Once you have authorized the application, you will be provided a BOT Access token. Kindly note down that token as it will be required while deploying BotKube backend to your Kubernetes cluster.

Alternatively, you can install BotKube Slack app from Slack app directory.

Add BotKube user to a Slack channel

After installing BotKube app to your Slack workspace, you could see a new bot user with the name “BotKube” added in your workspace. Add that bot to a Slack channel you want to receive notification in.
(You can add it by inviting @BotKube in a channel)

Install BotKube Backend in Kubernetes cluster

Using helm

  • We will be using helm to install BotKube in Kubernetes. Follow this guide to install helm if you don’t have it installed already
  • Add infracloudio chart repository
$ helm repo add infracloudio https://infracloudio.github.io/charts
  • Deploy BotKube backend using helm install in your cluster.
$ helm repo update
$ helm install --version v0.9.1 --name botkube --namespace botkube \
--set config.communications.slack.enabled=true \
--set config.communications.slack.channel=<SLACK_CHANNEL_NAME> \
--set config.communications.slack.token=<SLACK_API_TOKEN_FOR_THE_BOT> \
--set config.settings.clustername=<CLUSTER_NAME> \
--set config.settings.allowkubectl=<ALLOW_KUBECTL> \
--set image.repository=infracloudio/botkube \
--set image.tag=v0.9.1 \
infracloudio/botkube

where,
- SLACK_CHANNEL_NAME is the channel name where @BotKube is added
- SLACK_API_TOKEN_FOR_THE_BOT is the Token you received after installing BotKube app to your Slack workspace
- CLUSTER_NAME is the cluster name set in the incoming messages
- ALLOW_KUBECTL set true to allow kubectl command execution by BotKube on the cluster

Configuration syntax is explained here.

Send @BotKube ping in the channel to see if BotKube is running and responding.

With the default configuration, BotKube will watch all the resources in all the namespaces for create, delete and error events.
If you wish to monitor only specific resources, follow the steps given below:

  • Create new file config.yaml and add resource configuration as described on the configuration page.

    (You can refer sample config from https://github.com/infracloudio/botkube/tree/develop/helm/botkube/sample-res-config.yaml)

    config:
      ## Resources you want to watch
      resources:
        - name: pod                # Name of the resources e.g pod, deployment, ingress, etc.
          namespaces:              # List of namespaces, "all" will watch all the namespaces
            include:
              - all
            ignore:
              - kube-system
          events:                  # List of lifecycle events you want to receive, e.g create, update, delete, error OR all
            - create
            - delete
            - error
        - name: job
          namespaces:
            include:
              - all
            ignore:
              - dev
          events:
            - create
            - update
            - delete
            - error
    
  • Pass the yaml file as a flag to helm install command. e.g

    helm install --version v0.9.1 --name botkube --namespace botkube -f /path/to/config.yaml --set=...other args..
    

Alternatively, you can also update the configuration at runtime as documented here

Using kubectl

  • Make sure that you have kubectl cli installed and have access to Kubernetes cluster
  • Download deployment specs yaml
$ wget -q https://raw.githubusercontent.com/infracloudio/botkube/master/deploy-all-in-one.yaml
  • Open downloaded deploy-all-in-one.yaml and update the configuration.
    Set SLACK_ENABLED, SLACK_CHANNEL, SLACK_API_TOKEN, clustername, allowkubectl and update the resource events configuration you want to receive notifications for in the configmap.

where,
- SLACK_ENABLED set true to enable Slack support for BotKube
- SLACK_CHANNEL is the channel name where @BotKube is added
- SLACK_API_TOKEN is the Token you received after installing BotKube app to your Slack workspace
- clustername is the cluster name set in the incoming messages
- allowkubectl set true to allow kubectl command execution by BotKube on the cluster

Configuration syntax is explained here.

  • Create botkube namespace and deploy resources
$ kubectl create ns botkube && kubectl create -f deploy-all-in-one.yaml -n botkube
  • Check pod status in botkube namespace. Once running, send @BotKube ping in the Slack channel to confirm if BotKube is responding correctly.


Remove BotKube from Slack workspace

  • Goto Slack manage apps page
  • Click on “BotKube” and click on “Remove App” button

Remove BotKube from Kubernetes cluster

Using helm

If you have installed BotKube backend using helm, execute following command to completely remove BotKube and related resources from your cluster

$ helm delete --purge botkube

BotKube install: Using kubectl

$ kubectl delete -f https://raw.githubusercontent.com/infracloudio/botkube/master/deploy-all-in-one.yaml -n botkube