ElasticSearch

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.elasticsearch.enabled=true \
--set config.communications.elasticsearch.server=<ELASTICSEARCH_ADDRESS> \
--set config.communications.elasticsearch.username=<ELASTICSEARCH_USERNAME> \
--set config.communications.elasticsearch.password=<ELASTICSEARCH_PASSWORD> \
--set config.communications.elasticsearch.index.name=<ELASTICSEARCH_INDEX_NAME> \
--set config.communications.elasticsearch.index.type=<ELASTICSEARCH_INDEX_TYPE> \
--set config.communications.elasticsearch.index.shards=<ELASTICSEARCH_INDEX_SHARDS> \
--set config.communications.elasticsearch.index.replicas=<ELASTICSEARCH_INDEX_REPLICAS> \
--set config.settings.clustername=<CLUSTER_NAME> \
--set image.repository=infracloudio/botkube \
--set image.tag=v0.9.1 \
infracloudio/botkube

where,
- ELASTICSEARCH_ADDRESS is an address on which ElasticSearch server is reachable e.g https://example.com:9243
- ELASTICSEARCH_USERNAME is the username for authentication to Els server
- ELASTICSEARCH_PASSWORD is a password for the username to authenticate with Els server
- ELASTICSEARCH_INDEX_NAME (optional) is an index name on which BotKube events will be stored (default: botkube)
- ELASTICSEARCH_INDEX_TYPE (optional) contains type for the BotKube index (default: botkube-event)
- ELASTICSEARCH_INDEX_SHARDS (optional) denotes number of shards for BotKube index (default: 1)
- ELASTICSEARCH_INDEX_REPLICAS (optional) is the number of replicas of the shards (default: 0)
- CLUSTER_NAME is the cluster name set in the incoming messages

Configuration syntax is explained here.

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 ELASTICSEARCH_ENABLED=true, ELASTICSEARCH_USERNAME, ELASTICSEARCH_PASSWORD, clustername, index settings and update the resource events configuration you want to receive notifications for in the configmap.

where,
- ELASTICSEARCH_ADDRESS is an address on which ElasticSearch server is reachable e.g https://example.com:9243
- ELASTICSEARCH_USERNAME is the username for authentication to Els server
- ELASTICSEARCH_PASSWORD is a password for the username to authenticate with Els server

  • 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.

Remove BotKube

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