botkube: Couldn't configure Mattermost integration.

Description

Hi. I tried to install botkube on my k8s cluster to notify k8s events in mattermost. Unfortunately my attempts to configure botkube failed. I read twice or thrice this issue, but this in not my case. Firstly, I used 1.1.0 image version and my mm instance hasn’t subpath. Command used:

export MATTERMOST_BOT_NAME="botkube"
export MATTERMOST_TOKEN="xxxxxxxxxxxxxxx"
export MATTERMOST_CHANNEL="kubernetes"


export MATTERMOST_SERVER_URL="https://mm.company.org/"
export MATTERMOST_CERT="/root/certificate.cer"
export MATTERMOST_TEAM="team"
export CLUSTER_NAME="some-cluster"
export ALLOW_KUBECTL=true
export ALLOW_HELM=true

helm install --version v1.1.0 botkube --namespace botkube --create-namespace \
    --set communications.default-group.mattermost.enabled=true \
    --set communications.default-group.mattermost.url=${MATTERMOST_SERVER_URL} \
    --set communications.default-group.mattermost.token=${MATTERMOST_TOKEN} \
    --set communications.default-group.mattermost.cert=${MATTERMOST_CERT} \
    --set communications.default-group.mattermost.team=${MATTERMOST_TEAM} \
    --set communications.default-group.mattermost.channels.default.name=${MATTERMOST_CHANNEL} \
    --set communications.default-group.mattermost.botName=${MATTERMOST_BOT_NAME} \
    --set settings.clusterName=${CLUSTER_NAME} \
    --set 'settings.log.level=debug' \
    --set='sources.k8s-err-events.botkube/kubernetes.config.log.level=debug' \
    --set='sources.k8s-recommendation-events.botkube/kubernetes.config.log.level=debug' \
    --set='extraEnv[0].name=LOG_LEVEL_SOURCE_BOTKUBE_KUBERNETES' \
    --set='extraEnv[0].value=debug' \
    --set executors.k8s-default-tools.botkube/kubectl.enabled=${ALLOW_KUBECTL} \
    --set executors.k8s-default-tools.botkube/helm.enabled=${ALLOW_HELM} \
botkube/botkube

Expected behavior

Would like to see welcome message in mm channel

Actual behavior

Pod’s logs are below:

time="2023-06-26T17:49:19Z" level=info msg="Using API Key starting with \"xUd\"..." component="Analytics reporter"
time="2023-06-26T17:49:19Z" level=debug msg="Marking executor plugin as enabled" groupName=k8s-default-tools pluginKey=botkube/kubectl
time="2023-06-26T17:49:19Z" level=debug msg="Marking executor plugin as enabled" groupName=k8s-default-tools pluginKey=botkube/helm
time="2023-06-26T17:49:19Z" level=debug msg="Source plugin defined and enabled but not used by any platform or standalone action" groupName=k8s-all-events pluginKey=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=debug msg="Source plugin defined and enabled but not used by any platform or standalone action" groupName=k8s-create-events pluginKey=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=debug msg="Marking source plugin as enabled" groupName=k8s-err-events pluginKey=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=debug msg="Source plugin defined and enabled but not used by any platform or standalone action" groupName=k8s-err-with-logs-events pluginKey=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=debug msg="Marking source plugin as enabled" groupName=k8s-recommendation-events pluginKey=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=debug msg="Source plugin defined but not enabled." groupName=prometheus pluginKey=botkube/prometheus
time="2023-06-26T17:49:19Z" level=info msg="Starting Plugin Manager for all enabled plugins" component="Plugin Manager" enabledExecutors="botkube/kubectl,botkube/helm" enabledSources=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=info msg="Ensuring plugin dependencies are downloaded..." binPath=/tmp/botkube/executor_v1.1.0_kubectl component="Plugin Manager"
time="2023-06-26T17:49:19Z" level=debug msg="Binary \"kubectl\" found locally. Skipping..." component="Plugin Manager"
time="2023-06-26T17:49:19Z" level=info msg="Executor plugin registered successfully." binPath=/tmp/botkube/executor_v1.1.0_kubectl component="Plugin Manager" plugin=botkube/kubectl version=v1.1.0
time="2023-06-26T17:49:19Z" level=info msg="Ensuring plugin dependencies are downloaded..." binPath=/tmp/botkube/executor_v1.1.0_helm component="Plugin Manager"
time="2023-06-26T17:49:19Z" level=debug msg="Binary \"helm\" found locally. Skipping..." component="Plugin Manager"
time="2023-06-26T17:49:19Z" level=info msg="Executor plugin registered successfully." binPath=/tmp/botkube/executor_v1.1.0_helm component="Plugin Manager" plugin=botkube/helm version=v1.1.0
time="2023-06-26T17:49:19Z" level=info msg="Explicitly using Info level as custom log level was not set by \"LOG_LEVEL_EXECUTOR_BOTKUBE_KUBECTL\" environment variable" component="Plugin Manager"
time="2023-06-26T17:49:19Z" level=warning msg="plugin configured with a nil SecureConfig" plugin=botkube/kubectl
time="2023-06-26T17:49:19Z" level=info msg="Explicitly using Info level as custom log level was not set by \"LOG_LEVEL_EXECUTOR_BOTKUBE_HELM\" environment variable" component="Plugin Manager"
time="2023-06-26T17:49:19Z" level=warning msg="plugin configured with a nil SecureConfig" plugin=botkube/helm
time="2023-06-26T17:49:19Z" level=info msg="Ensuring plugin dependencies are downloaded..." binPath=/tmp/botkube/source_v1.1.0_kubernetes component="Plugin Manager"
time="2023-06-26T17:49:19Z" level=info msg="Source plugin registered successfully." binPath=/tmp/botkube/source_v1.1.0_kubernetes component="Plugin Manager" plugin=botkube/kubernetes version=v1.1.0
time="2023-06-26T17:49:19Z" level=warning msg="plugin configured with a nil SecureConfig" plugin=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=debug msg="starting plugin" args="[/tmp/botkube/source_v1.1.0_kubernetes]" path=/tmp/botkube/source_v1.1.0_kubernetes plugin=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=debug msg="plugin started" path=/tmp/botkube/source_v1.1.0_kubernetes pid=41 plugin=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=debug msg="waiting for RPC address" path=/tmp/botkube/source_v1.1.0_kubernetes plugin=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=debug msg="plugin address" address=/tmp/plugin254384117 network=unix plugin=botkube/kubernetes subsystem_name=botkube/kubernetes.source_v1.1.0_kubernetes timestamp="2023-06-26T17:49:19.721Z"
time="2023-06-26T17:49:19Z" level=debug msg="using plugin" plugin=botkube/kubernetes version=1
W0626 17:49:19.722304       1 rest.go:17] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
time="2023-06-26T17:49:19Z" level=info msg="Starting server on address \":2114\"" component="Health server"
time="2023-06-26T17:49:19Z" level=info msg="Starting server on address \":2112\"" component="Metrics server"
time="2023-06-26T17:49:19Z" level=debug msg="Marking executor plugin as enabled" component="Help Executor" groupName=k8s-default-tools pluginKey=botkube/kubectl
time="2023-06-26T17:49:19Z" level=debug msg="Marking executor plugin as enabled" component="Help Executor" groupName=k8s-default-tools pluginKey=botkube/helm
time="2023-06-26T17:49:19Z" level=debug msg="Source plugin defined and enabled but not used by any platform or standalone action" component="Help Executor" groupName=k8s-create-events pluginKey=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=debug msg="Marking source plugin as enabled" component="Help Executor" groupName=k8s-err-events pluginKey=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=debug msg="Source plugin defined and enabled but not used by any platform or standalone action" component="Help Executor" groupName=k8s-err-with-logs-events pluginKey=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=debug msg="Marking source plugin as enabled" component="Help Executor" groupName=k8s-recommendation-events pluginKey=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=debug msg="Source plugin defined but not enabled." component="Help Executor" groupName=prometheus pluginKey=botkube/prometheus
time="2023-06-26T17:49:19Z" level=debug msg="Source plugin defined and enabled but not used by any platform or standalone action" component="Help Executor" groupName=k8s-all-events pluginKey=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=debug msg="received EOF, stopping recv loop" err="rpc error: code = Unavailable desc = error reading from server: EOF" plugin=botkube/kubernetes subsystem_name=botkube/kubernetes.stdio
time="2023-06-26T17:49:19Z" level=info msg="plugin process exited" path=/tmp/botkube/executor_v1.1.0_helm pid=29 plugin=botkube/helm
time="2023-06-26T17:49:19Z" level=info msg="plugin process exited" path=/tmp/botkube/executor_v1.1.0_kubectl pid=19 plugin=botkube/kubectl
time="2023-06-26T17:49:19Z" level=info msg="plugin process exited" path=/tmp/botkube/source_v1.1.0_kubernetes pid=41 plugin=botkube/kubernetes
time="2023-06-26T17:49:19Z" level=debug msg="plugin exited" plugin=botkube/kubernetes

Steps to reproduce

$ kubectl get pods -n botkube
NAME                     READY   STATUS    RESTARTS   AGE
botkube-b7997c5d-726lx   1/2     Running   0          45s

In additional, I would like to note that team and channel names displayed in UI may not be the same as real name. In UI shows display_name, but actual name available via restapi. I tried both. No success. Could you please tell me what is wrong with my configuration?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

@huseyinbabal about removing the trailing slash automatically with strings.TrimSuffix? This sounds like a low-hanging fruit to me, which could be done as a part of Mattermost bot constructor. WDYT?

Sure, we can totally do that.

After pairing with @belkevglaz, we found that the issue is caused by a trailing slash at the end of mattermost server URL. So, it is fixed after updating https://example.com/ as https://example.com.

I’m in.

Hi @huseyinbabal. Checked twice. No any other instances

Checked before install by kubectl

kubectl get all -n botkube
No resources found in botkube namespace.

After helm installed

kubectl get all -n botkube
NAME                           READY   STATUS             RESTARTS      AGE
pod/botkube-5dc5d8995c-m5nv7   1/2     CrashLoopBackOff   2 (10s ago)   49s

NAME              TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)    AGE
service/botkube   ClusterIP   10.2.235.88   <none>        2113/TCP   49s

NAME                      READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/botkube   0/1     1            0           49s

NAME                                 DESIRED   CURRENT   READY   AGE
replicaset.apps/botkube-5dc5d8995c   1         1         0       49s

And finally after helm uninstalled

kubectl get all -n botkube
No resources found in botkube namespace.