New: K8sGPT Auto Remediation!

Back to Documentation

Slack Integration

Learn how to integrate K8sGPT with Slack for automated Kubernetes insights

Overview

The Slack integration allows you to receive K8sGPT analysis results directly in your Slack channels. This enables real-time monitoring and quick response to Kubernetes cluster issues.

Prerequisites

  • K8sGPT installed and configured in your cluster
  • Slack workspace with admin permissions
  • Slack app created with appropriate permissions
  • Slack Bot User OAuth Token

Setting Up Slack

  1. Create a new Slack app at api.slack.com/apps
  2. Add the following bot token scopes:
    • chat:write
    • channels:read
    • channels:join
  3. Install the app to your workspace
  4. Copy the Bot User OAuth Token

Configuring K8sGPT

Add the following configuration to your K8sGPT deployment:

apiVersion: v1
kind: Secret
metadata:
  name: k8sgpt-slack-secret
type: Opaque
stringData:
  SLACK_TOKEN: "xoxb-your-token"
  SLACK_CHANNEL: "#kubernetes-alerts"

Features

  • Real-time analysis notifications
  • Customizable message formatting
  • Multiple channel support
  • Severity-based notifications
  • Interactive message actions

Message Format

K8sGPT messages in Slack include:

  • Issue severity and description
  • Affected resources
  • Recommended actions
  • Links to relevant documentation
  • Timestamp and cluster information

Best Practices

  • Use dedicated channels for different severity levels
  • Configure notification frequency to avoid alert fatigue
  • Set up proper access controls for the Slack app
  • Regularly rotate the Slack token
  • Monitor the integration's performance

Troubleshooting

Common issues and solutions:

  • Check Slack token permissions and validity
  • Verify channel names and access
  • Ensure proper network connectivity
  • Check K8sGPT logs for errors
  • Verify Slack app installation status