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 botkube chart repository:

    $ helm repo add botkube https://charts.botkube.io
    $ helm repo update
    
  • Deploy BotKube backend using helm install in your cluster:

    $ helm install --version v0.12.4 botkube --namespace botkube --create-namespace \
    --set communications.elasticsearch.enabled=true \
    --set communications.elasticsearch.server=<ELASTICSEARCH_ADDRESS> \
    --set communications.elasticsearch.username=<ELASTICSEARCH_USERNAME> \
    --set communications.elasticsearch.password=<ELASTICSEARCH_PASSWORD> \
    --set communications.elasticsearch.index.name=<ELASTICSEARCH_INDEX_NAME> \
    --set communications.elasticsearch.index.type=<ELASTICSEARCH_INDEX_TYPE> \
    --set communications.elasticsearch.index.shards=<ELASTICSEARCH_INDEX_SHARDS> \
    --set communications.elasticsearch.index.replicas=<ELASTICSEARCH_INDEX_REPLICAS> \
    --set config.settings.clustername=<CLUSTER_NAME> \
    --set image.tag=v0.12.4 \
    botkube/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. Full Helm chart parameters list is documented 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:

    config:
      ## Resources you want to watch
      resources:
      - name: v1/pods        # Name of the resource. Resource name must be in
                             # group/version/resource (G/V/R) format
                             # resource name should be plural
                             # (e.g apps/v1/deployments, v1/pods)
        namespaces:          # List of namespaces, "all" will watch all the namespaces
          include:
          - all
          ignore:            # List of namespaces to be ignored, used only with include: all
          - kube-system      # 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
        - delete
        - error
      - name: batch/v1/jobs
        namespaces:
          include:
          - ns1
          - ns2
        events:
        - create
        - update
        - delete
        - error
        updateSetting:
          includeDiff: true
          fields:
          - spec.template.spec.containers[*].image
          - status.conditions[*].type
    
    • Pass the YAML file as a flag to helm install command, e.g.:

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

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

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 uninstall botkube