Botkube
Botkube Installation Guide
Overview
This guide covers the installation of Botkube on a K3s Raspberry Pi 5 cluster with Slack integration, using HashiCorp Vault for secret management and FluxCD for GitOps deployment.
Architecture
- Cluster: K3s on Raspberry Pi 5
- GitOps: FluxCD
- Secret Management: HashiCorp Vault + External Secrets Operator
- Communication: Slack (Socket Mode)
- Storage: Persistent volume for plugin caching
Prerequisites
- K3s cluster running
- FluxCD installed and configured
- HashiCorp Vault deployed with KV secrets engine
- External Secrets Operator installed with ClusterSecretStore configured
- Slack workspace with admin access
Directory Structure
Step 1: Create Slack App
1.1 Create the App
- Go to https://api.slack.com/apps
- Click “Create New App” → “From scratch”
- Name it “Botkube” (or your preferred name)
- Select your workspace
1.2 Configure OAuth Scopes
Navigate to OAuth & Permissions and add these Bot Token Scopes:
app_mentions:read- View messages that directly mention the botchannels:history- View messages in public channelschannels:read- View basic channel informationchat:write- Send messagescommands- Add shortcuts and/or slash commandsfiles:write- Upload filesusers:read- View people in the workspaceusers:read.email- View email addresses (optional)
1.3 Enable Socket Mode
- Go to Socket Mode in the sidebar
- Enable Socket Mode
- Generate an App-Level Token with
connections:writescope - Save the token (starts with
xapp-)
1.4 Get Bot Token
- Go to OAuth & Permissions
- Click “Install to Workspace”
- Copy the Bot User OAuth Token (starts with
xoxb-)
1.5 Configure App Display
- Go to Basic Information
- Under Display Information:
- Upload Kubernetes icon (download from: https://raw.githubusercontent.com/cncf/artwork/master/projects/kubernetes/icon/color/kubernetes-icon-color.png)
- Add app description
- Set background color
1.6 Create Slack Channel
- Create a channel in Slack (e.g.,
k3s-pi5cluster)- Note: Channel name must be lowercase, no special characters
- Invite your Botkube app to the channel:
/invite @Botkube
Step 2: Store Secrets in Vault
Store your Slack tokens in Vault:
Note: Adjust the path (secret/botkube-slack-secrets) based on your Vault mount point.
Step 3: Deploy Botkube with FluxCD
3.1 Create Namespace
File: infrastructure/controllers/base/botkube/namespace.yaml
3.2 Add Helm Repository
File: infrastructure/controllers/base/botkube/repository.yaml
3.3 Create PersistentVolumeClaim for Plugin Cache
File: infrastructure/controllers/base/botkube/pvc.yaml
Why PVC? Plugin downloads on Raspberry Pi can take 2-3 minutes. Caching plugins in a PVC reduces restart time from minutes to seconds.
3.4 Configure Helm Values
File: infrastructure/controllers/base/botkube/values.yaml
3.5 Create HelmRelease
File: infrastructure/controllers/base/botkube/release.yaml
3.6 Create Kustomize Configuration
File: infrastructure/controllers/base/botkube/kustomizeconfig.yaml
File: infrastructure/controllers/base/botkube/kustomization.yaml
Step 4: Configure External Secrets
4.1 Create ExternalSecret
File: infrastructure/configs/base/botkube/botkube-slack-secrets.yaml
Key Points:
- The ExternalSecret creates a Kubernetes Secret with a
comm_config.yamlfile - Botkube automatically loads this config via
existingCommunicationsSecretName - Tokens are templated from Vault into the YAML config
- Secret refreshes every 15 seconds
4.2 Create Kustomization
File: infrastructure/configs/base/botkube/kustomization.yaml
Step 5: Deploy
5.1 Commit and Push
5.2 Trigger FluxCD Reconciliation
5.3 Monitor Startup
Expected startup time: 3-5 minutes on first deployment (downloading plugins), then 10-30 seconds on subsequent restarts (using cached plugins).
Step 6: Verify Installation
6.1 Check Logs
Look for these successful initialization messages:
6.2 Test in Slack
Go to your Slack channel and try these commands:
6.3 Check Notifications
Deploy a test pod to trigger Kubernetes event notifications:
You should see notifications in your Slack channel.
Troubleshooting
Pod Stuck in CrashLoopBackOff
Symptoms: Pod restarts repeatedly, never becomes Ready.
Common causes:
- Health checks too aggressive for slow plugin downloads
- Invalid Slack tokens
- Secret not mounted correctly
Solutions:
Slack Connection Issues
Symptoms: “missing_scope” or connection errors in logs.
Solution: Verify all required OAuth scopes are added (see Step 1.2), then reinstall the app to your workspace and update the Bot Token in Vault.
Slow Startup Times
Symptoms: Pod takes 3+ minutes to become Ready.
Solution: This is normal on first start. The PVC caches plugins for faster subsequent starts. To verify caching is working:
ExternalSecret Not Syncing
Symptoms: ExternalSecret shows “SecretSyncedError” status.
Solutions:
Channel Name Issues
Symptoms: Warning about invalid channel name.
Solution: Slack channel names must be lowercase with no special characters. Update both:
- The actual Slack channel name
- The channel name in
botkube-slack-secrets.yaml
Configuration Options
Customize Notifications
Edit the values.yaml to change which events trigger notifications:
Add Multiple Channels
In botkube-slack-secrets.yaml, add more channels:
Change Cluster Name
Update in values.yaml:
Maintenance
Update Botkube
FluxCD automatically updates Botkube when new versions matching 1.* are released. To force an update:
Rotate Slack Tokens
- Generate new tokens in Slack App settings
- Update Vault:
- Wait 15 seconds for ExternalSecret to sync
- Botkube automatically reloads (Config Watcher detects changes)
View Cached Plugins
Clear Plugin Cache
Security Considerations
- Vault Access: Ensure only the External Secrets Operator service account can read the Botkube secrets path
- Slack Tokens: Never commit tokens to Git - always use Vault
- RBAC: Review Botkube’s RBAC permissions in the Helm chart
- Network Policies: Consider adding NetworkPolicy to restrict Botkube’s network access
Resources
Summary
You now have:
- ✅ Botkube deployed via GitOps
- ✅ Secrets managed securely in Vault
- ✅ Automatic secret synchronization
- ✅ Plugin caching for fast restarts
- ✅ Slack integration with custom icon
- ✅ Kubernetes event notifications
Enjoy your automated Kubernetes monitoring! 🚀