Follow the steps below to install BotKube in your Mattermost Team (v5.14.0).
Login with System Admin account, and in the Menu proceed to System console > Integrations > Integration Management and enable Personal Access Token.
To create a BotKube user, if not already created, proceed to the menu and Get a team invite link. Logout from the admin account and paste the link in the address bar and create a user with the username BotKube.
You can also use a custom username for your bot. However, it needs to be passed during BotKube installation in one of the further steps.
Login as System Admin, in the Menu, proceed to System console > Users. For BotKube user, Manage Roles and allow tokens and post_all access.
Login as BotKube user, in the Menu, proceed to Account Settings > Security > Personal Access Token > Create and save the token.
Add BotKube user created to the channel you want to receive notifications in.
1. First, go to Main Menu > Integrations > Slash Commands. (If you don’t have the Integrations option in your Main Menu, slash commands may not be enabled on your Mattermost server or maybe disabled for non-admins. Enable them from System Console > Integrations > Custom Integrations in prior versions)
2. Click Add Slash Command and add the following details for the command and click Save.
|Description||Show BotKube help|
|Command Trigger Word||botkubehelp|
3. Verify executing /botkubehelp in a channel.
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.mattermost.enabled=true \ --set communications.mattermost.url=<MATTERMOST_SERVER_URL> \ --set communications.mattermost.cert=<MATTERMOST_CERT> \ --set communications.mattermost.token=<MATTERMOST_TOKEN> \ --set communications.mattermost.team=<MATTERMOST_TEAM> \ --set communications.mattermost.channel=<MATTERMOST_CHANNEL> \ --set communications.mattermost.botName=<MATTERMOST_BOT_NAME> \ --set config.settings.clustername=<CLUSTER_NAME> \ --set config.settings.kubectl.enabled=<ALLOW_KUBECTL> \ --set image.tag=v0.12.4 \ botkube/botkube
MATTERMOST_SERVER_URL is the URL (including http/https schema) where Mattermost is running
MATTERMOST_CERT is the SSL certificate file for HTTPS connection. Place it in Helm directory and specify the path
MATTERMOST_TOKEN is the Token received by creating Personal Access Token for BotKube user
MATTERMOST_TEAM is the Team name where BotKube is added
MATTERMOST_CHANNEL is the Channel name where BotKube is added and used for communication
MATTERMOST_BOT_NAME is the Mattermost bot username (usually it is
CLUSTER_NAME is the cluster name set in the incoming messages
ALLOW_KUBECTL set true to allow kubectl command execution by BotKube on the cluster
To deploy with TLS, replace MATTERMOST_CERT with the location of the SSL certificate file placed in Helm directory. Leave this value to None if deploying without TLS.
Send @BotKube ping in the channel to see if BotKube is running and responding.
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://raw.githubusercontent.com/kubeshop/botkube/v0.12.4/helm/botkube/sample-res-config.yaml)
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
If you have installed BotKube backend using helm, execute following command to completely remove BotKube and related resources from your cluster
$ helm uninstall botkube