Search…
TVK Integration with Slack using BotKube
This section provides step by step instructions to install and configure BotKube to monitor TVK resources from Slack along with other native Kubernetes resources.

Introduction

In today's world, it's imperative to be able to receive notifications for your Kubernetes environments into communication and notification tools of choice. Slack is a new-age communication tool leveraged by a lot of different teams and organizations today. In order to keep a consistent user experience across ecosystem tools leveraged by TVK users, notifications can be supported within Slack for TVK resources through BotKube.
This page guides you with detailed instructions to install BotKube on a Kubernetes cluster, configure it to integrate with Slack, and monitor TVK resources to provide notifications around TVK activity within Slack channels directly.

What is BotKube

BotKube is a messaging bot for monitoring and debugging Kubernetes clusters. It can be integrated with multiple messaging platforms like - Slack, Mattermost, Microsoft Teams, Discord to help you monitor TVK resources and other Kubernetes resources.

Install and configure BotKube with Slack

Install BotKube App to Slack workspace

    1.
    Search for the BotKube application in the Apps section on Slack, install the application using the Add to Slack button provided.
    2.
    After you authorize the application, you will get a BOT Access token. Note down this token as it will be required during deployment of BotKube backend on Kubernetes cluster.
Search and install BotKube application on Slack

Add BotKube App as a user to Slack Channel

Once the BotKube application is installed to the Slack workspace, you can see BotKube user (@Botkube) present. Add this Botkube user to your slack channel from where you want to monitor the TVK resources.
BotKube user in Slack workspace
Invite the BotKube user to Slack channel

Install BotKube backend in Kubernetes Cluster

    1.
    Add infracloudio chart repository to the Kubernetes cluster
1
helm repo add infracloudio https://infracloudio.github.io/charts
2
helm repo update
Copied!
2. Install BotKube backend with required input parameters to configure Slack communication
1
helm install --version v0.12.1 botkube --namespace botkube \
2
--set communications.slack.enabled=true \
3
--set communications.slack.channel=<SLACK_CHANNEL_NAME> \
4
--set communications.slack.token=<xoxb-SLACK_API_TOKEN_FOR_THE_BOT> \
5
--set config.settings.clustername=<K8S_CLUSTER_NAME> \
6
--set config.settings.kubectl.enabled=<ALLOW_KUBECTL_true_or_false>\
7
--set image.repository=infracloudio/botkube \
8
--set image.tag=v0.12.1 \
9
infracloudio/botkube
Copied!
3. Verify that the botkube controller pod is in running state
1
kubectl get pod -n botkube
Copied!
1
NAME READY STATUS RESTARTS AGE
2
botkube-6fdf477b-gskb7 1/1 Running 9 12d
Copied!
After the above installation with default configuration, BotKube will watch all the resources in all the namespaces for create, delete and error events for configured Kubernetes cluster.

Configure TVK Resource Monitoring

    1.
    Along with default configurations, we will update the botkube-configmap with TVK custom resources for monitoring
1
kubectl get configmap -n botkube
Copied!
1
NAME DATA AGE
2
botkube-configmap 1 14d
3
kube-root-ca.crt 1 15d
Copied!
2. Add TVK custom resources to the BotKube configmap
1
kubectl edit configmap botkube-configmap -n botkube
Copied!
1
apiVersion: v1
2
data:
3
resource_config.yaml: |
4
recommendations: true
5
resources:
6
- events:
7
- all
8
name: triliovault.trilio.io/v1/licenses
9
namespaces:
10
ignore:
11
- null
12
include:
13
- all
14
- events:
15
- all
16
name: triliovault.trilio.io/v1/targets
17
namespaces:
18
ignore:
19
- null
20
include:
21
- all
22
- events:
23
- all
24
name: triliovault.trilio.io/v1/policies
25
namespaces:
26
ignore:
27
- null
28
include:
29
- all
30
- events:
31
- all
32
name: triliovault.trilio.io/v1/hooks
33
namespaces:
34
ignore:
35
- null
36
include:
37
- all
38
- events:
39
- all
40
name: triliovault.trilio.io/v1/backupplans
41
namespaces:
42
ignore:
43
- null
44
include:
45
- all
46
- events:
47
- all
48
name: triliovault.trilio.io/v1/backups
49
namespaces:
50
ignore:
51
- null
52
include:
53
- all
54
- events:
55
- all
56
name: triliovault.trilio.io/v1/restores
57
namespaces:
58
ignore:
59
- null
60
include:
61
- all
Copied!
The above configuration is for the Cluster scoped installation of TVK. We have specified to include all namespaces for notifications using the following syntax namespaces: -> include: -> -all
In the case of namespace scoped installation of TVK, you can include only the specific namespace where TVK is installed.
3. This update will start populating any operations done on the TVK resources.
TVK target resource is created
TVK policy resource is created

Configure TVK Resource Commands to execute from Slack

    1.
    You can expand the list of commands that can be executed from slack directly onto the Kubernetes resources and TVK resources.
1
kubectl edit configmap botkube-configmap -n botkube
Copied!
2. Add the commands that can be executed on the TVK resources along with the verbs under settings.kubectl.commands.resources and settings.kubectl.commands.verbs section
1
settings:
2
clustername: east-2-rke-120
3
configwatcher: true
4
kubectl:
5
commands:
6
resources:
7
- deployments
8
- pods
9
- namespaces
10
- daemonsets
11
- statefulsets
12
- storageclasses
13
- nodes
14
- licenses
15
- policies
16
- hooks
17
- targets
18
- backupplans
19
- backups
20
- restores
21
- triliovaultmanagers
22
verbs:
23
- api-resources
24
- api-versions
25
- cluster-info
26
- describe
27
- diff
28
- explain
29
- get
30
- logs
31
- top
32
- auth
33
- create
34
- get
35
- edit
36
- delete
37
defaultNamespace: default
Copied!
3. Once the Botkube configmap is updated, you can see the updated commands list from slack
Commands lists on slack after updating the configmap

Usage of commands and verbs

You can execute above commands directly from slack to monitor the TVK resources
Get backupplan command execution from Slack
Get backup command execution from Slack

Remove BotKube from Kubernetes cluster

We installed BotKube using helm, execute the following command to completely remove BotKube and related resources.
1
helm delete --purge botkube -n botkube
Copied!
For integrations with other tools such as Mattermost, Microsoft Teams, Discord, Elastic Search configurations, users can follow BotKube documentations.
Last modified 3mo ago