SlackΒΆ
Robusta can report issues and events in your Kubernetes cluster to Slack.
Connecting SlackΒΆ
When installing Robusta, run robusta gen-config
and follow the prompts. This will use our official
Slack app.
Note: Robusta can only write messages and doesn't require read permissions.
Alternatively, generate a key by running robusta integrations slack
and set the following Helm values in your
generated_values.yaml
:
sinks_config:
# slack integration params
- slack_sink:
name: main_slack_sink
api_key: MY SLACK KEY # to avoid putting your key in Helm values, see below
slack_channel: MY SLACK CHANNEL
max_log_file_limit_kb: <Optional> # (Default: 1000) The maximum allowed file size for "snippets" (in kilobytes) uploaded to the Slack channel. Larger files can be sent to Slack, but they may not be viewable directly within the Slack.
channel_override: DYNAMIC SLACK CHANNEL OVERRIDE (Optional)
investigate_link: true/false # optional, if false no investigate links/buttons will be included in Slack messages
Then do a Helm Upgrade.
Warning
If you don't want to put your Slack key in Helm values, you can use a secret. See the Managing Secrets section for more information.
Notification GroupingΒΆ
Slack allows grouping multiple notifications into summary messages and Slack threads. Refer to Notification Grouping.
Dynamic Slack ChannelsΒΆ
You can set the Slack
channel dynamically, based on the cluster name
or a value of a specific label
or annotation
.
This can be done using the optional channel_override
sink parameter.
Allowed values for this parameter are:
cluster_name
- The Slack channel will be the Robustacluster_name
labels.foo
- The Slack channel will be taken from alabel
value with the keyfoo
. If no such label, the default channel will be used.annotations.anno
- The Slack channel will be taken from anannotation
value with the keyanno
. If no such annotation, the default channel will be used.
For example:
sinks_config:
# slack integration params
- slack_sink:
name: main_slack_sink
api_key: xoxb-112...
slack_channel: my-fallback-channel
channel_override: "labels.slack"
A replacement pattern is also allowed, using $
sign, before the variable.
For cases where labels or annotations include special characters, such as ${annotations.kubernetes.io/service-name}
, you can use the ${} replacement pattern to represent the entire key, including special characters.
For example, if you want to dynamically set the Slack channel based on the annotation kubernetes.io/service-name
, you can use the following syntax:
channel_override: "${annotations.kubernetes.io/service-name}"
Example:
sinks_config:
# slack integration params, like slack_channel, api_key etc
- slack_sink:
name: main_slack_sink
api_key: xoxb-112...
slack_channel: my-fallback-channel
channel_override: "$cluster_name-alerts-$labels.env-${annotations.kubernetes.io/service-name}"
Using Private ChannelsΒΆ
Add Robusta to your workspace using the instructions above.
Add the Robusta app to the private channel. See the video below for instructions:
Automatically @mentioning UsersΒΆ
It is possible to automatically tag users in Slack.
To do so in custom playbooks mention the @username
anywhere in the description:
customPlaybooks:
- triggers:
- on_kubernetes_warning_event:
include: ["TooManyPods"]
actions:
- create_finding:
aggregation_key: "too-many-pods-warning"
severity: HIGH
title: "Too many pods on $node!"
description: "@some-user, please take a look." # (1)
@some-user will become a mention in Slack
If you'd like to automatically tag users on builtin alerts, please let us know. We want to hear requirements.
Creating Custom Slack AppsΒΆ
If you can't use the official Slack app, you can create your own. This is not recommended for most companies due to the added complexity.
Enable Socket mode in your Slack App.
Under "OAuth and Permissions" add the following scopes: chat:write, chat:write.public, files:write, incoming-webhook, and channels:history.
Under "Event Subscriptions" add bot user events for message.channels and press "Save Changes".
Click "Install into Workspace".
Copy the
Bot User OAuth Token
from "OAuth and Permissions".Add the token to SinksConfig in your generated_values.yaml file.
sinksConfig:
- slack_sink:
name: main_slack_sink
slack_channel: <your-channel>
api_key: <your Bot User OAuth Token>
Warning
When using a custom Slack app, callback buttons are not supported due to complexities in how Slack handles incoming messages. Contact us if you need assistance.