Discord
You can use Discord app to connect Botkube to your Discord Server.
Prerequisites​
- Botkube CLI installed according to the Getting Started guide
- Access to Kubernetes cluster
- Discord server account
Install Botkube to the Discord Server​
Follow the steps below to install Botkube Discord app to your Discord server.
Create Botkube app at your Discord Server​
-
Create a "New Application" named Botkube and add a bot named Botkube into the Application.
-
Copy the Application APPLICATION ID and export it as the
DISCORD_BOT_ID
environment variable.export DISCORD_BOT_ID={APPLICATION_ID}
-
Add a description -
Botkube helps you monitor your Kubernetes cluster, debug critical deployments and gives recommendations for standard practices by running checks on the Kubernetes resources.
.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.
-
Copy the Token and export it as the
DISCORD_TOKEN
environment variable.export DISCORD_TOKEN={TOKEN}
-
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.
Copy the channel ID and export it as the
DISCORD_CHANNEL_ID
environment variable.export DISCORD_CHANNEL_ID={ID}
-
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.
Install Botkube in Kubernetes cluster​
To deploy Botkube agent in your cluster, run:
export CLUSTER_NAME={cluster_name}
export ALLOW_KUBECTL={allow_kubectl}
botkube install --version v1.14.0 \
--set communications.default-group.discord.enabled=true \
--set communications.default-group.discord.channels.default.id=${DISCORD_CHANNEL_ID} \
--set communications.default-group.discord.botID=${DISCORD_BOT_ID} \
--set communications.default-group.discord.token=${DISCORD_TOKEN} \
--set settings.clusterName=${CLUSTER_NAME} \
--set 'executors.k8s-default-tools.botkube/kubectl.enabled'=${ALLOW_KUBECTL}
where:
- DISCORD_CHANNEL_ID is the channel name where @Botkube needs to send notifications,
- DISCORD_BOT_ID is the Botkube Application Client ID,
- DISCORD_TOKEN is the Token you received after adding Botkube bot to your Discord Application,
- 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.
Configuration syntax is explained here. All possible installation parameters are documented here.
Send @Botkube ping
in the channel to see if Botkube is running and responding.
Remove Botkube from Discord Server​
- Go to Discord Developers Portal Applications page,
- Click on "Botkube" and click on "Delete App" button.
Remove Botkube from Kubernetes cluster​
Execute the following command to completely remove Botkube and related resources from your cluster:
botkube uninstall