Follow the steps below to install BotKube Discord app to your Discord server.
Reach https://discordapp.com/developers/applications.
Create a “New Application” named BotKube and add a bot named BotKube into the Application.
Copy the Application APPLICATION ID and note it as it is required for BotKube installation.
Add a description - BotKube is a messaging bot for monitoring and debugging Kubernetes clusters. Visit https://botkube.io/usage for help.
.
Set the BotKube icon (BotKube icon can be downloaded from this link).
Click on Save Changes to update the Bot.
Now, reach the Bot page and Click Add Bot to add a Discord Bot to your application.
After Bot creation, now you can see a bot is added to your application. Click on the Reset Token button.
Note the token as it is required for BotKube installation.
Go to the OAuth2 page. Generate the URL with suitable permissions using the OAuth2 URL Generator available under the OAuth2 section to add bot to your Discord server.
the generated URL contains YOUR_CLIENT_ID, Scope and permission details.
https://discord.com/api/oauth2/authorize?client_id=<YOUR_CLIENT_ID>&permissions=<SET_OF_PERMISSIONS>&scope=bot
Copy and Paste the generated URL in a new tab, select the discord server to which you want to add the bot, click Continue and Authorize Bot addition.
Switch to the Discord app. Navigate to User settings and select Advanced tab.
Enable the Developer Mode.
Create a new channel or select an existing one and copy the CHANNEL ID.
To get the channel ID, right-click on a channel you want to receive notification in and click on Copy ID.
Note the copied channel ID as it is required for BotKube installation.
Now, go ahead and install the BotKube backend on your Kubernetes cluster.
Follow the first 4 mins of this Video Tutorial to understand the process visually.
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.discord.enabled=true \
--set communications.discord.channel=<DISCORD_CHANNEL_ID> \
--set communications.discord.botID=<DISCORD_BOT_ID> \
--set communications.discord.token=<DISCORD_TOKEN> \
--set config.settings.clustername=<CLUSTER_NAME> \
--set config.settings.kubectl.enabled=<ALLOW_KUBECTL> \
--set image.tag=v0.12.4 \
botkube/botkube
where,
Configuration syntax is explained here. Full Helm chart parameters list is documented here.
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