Elasticsearch notifier development
Botkube has stable support for Elasticsearch v8
and it is backward compatible to Elasticsearch v7
. If you are using Elasticsearch v7
, please follow the Elasticsearch v7 setup section.
Elasticsearch v8 setup​
The easiest way to develop Botkube with Elasticsearch notifier enabled is to install Elasticsearch on your local Kubernetes cluster via ECK.
Steps​
Install Elasticsearch:
- Install ECK custom resource definitions:
kubectl create -f https://download.elastic.co/downloads/eck/2.9.0/crds.yaml
- Install ECK operator:
kubectl apply -f https://download.elastic.co/downloads/eck/2.9.0/operator.yaml
- Deploy Elasticsearch:
cat <<EOF | kubectl apply -f -
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: elasticsearch
spec:
version: 8.9.1
nodeSets:
- name: default
count: 1
config:
node.store.allow_mmap: false
EOF
- Install ECK custom resource definitions:
Retrieve password
PASSWORD=$(kubectl get secret elasticsearch-es-elastic-user -o go-template='{{.data.elastic | base64decode}}')
Install Botkube with Elasticsearch, according to the Elasticsearch installation instruction, where:
ELASTICSEARCH_USERNAME
iselastic
,ELASTICSEARCH_PASSWORD
is$PASSWORD
,ELASTICSEARCH_ADDRESS
ishttps://elasticsearch-es-internal-http.default:9200
.
You don't need to set index name, type, shards and replicas. Also, during Botkube installation, you need to use
--set communications.default-group.elasticsearch.skipTLSVerify=true
flag to skip TLS verification.
To review if the events are properly saved in Elasticsearch, follow these steps:
Do port forward:
kubectl port-forward svc/elasticsearch-es-internal-http 9200
Fetch Elasticsearch indices:
curl -u "elastic:$PASSWORD" -k https://localhost:9200/_cat/indices
Copy the index name with the
botkube-
prefix and export it as environment variable. For example:export INDEX_NAME="botkube-2022-06-06"
See Elasticsearch index details with logged events:
curl -u "elastic:$PASSWORD" -k https://localhost:9200/$INDEX_NAME/_search\?pretty
Elasticsearch v7 setup​
The easiest way to develop Botkube with Elasticsearch notifier enabled is to install Elasticsearch on your local Kubernetes cluster.
Steps​
Install Elasticsearch:
helm repo add elastic https://helm.elastic.co
helm install elasticsearch elastic/elasticsearch --version 7.17.3 --set replicas=1 --set resources.requests.cpu="100m" --set resources.requests.memory="512M" --waitInstall Botkube with Elasticsearch, according to the Elasticsearch installation instruction, where:
ELASTICSEARCH_USERNAME
iselastic
,ELASTICSEARCH_PASSWORD
ischangeme
,ELASTICSEARCH_ADDRESS
ishttp://elasticsearch-master.default:9200
.
You don't need to set index name, type, shards and replicas.
To review if the events are properly saved in Elasticsearch, follow these steps:
Do port forward:
kubectl port-forward svc/elasticsearch-master 9200
Fetch Elasticsearch indices:
curl http://localhost:9200/_cat/indices
Copy the index name with the
botkube-
prefix and export it as environment variable. For example:export INDEX_NAME="botkube-2022-06-06"
See Elasticsearch index details with logged events:
curl http://localhost:9200/$INDEX_NAME/_search\?pretty