Skip to main content

Argo CD to Slack Notifications: The Complete Setup Guide

This document outlines the step-by-step process to configure Argo CD to send rich, detailed notifications to Slack whenever an application syncs, fails, or degrades.

βœ… Prerequisites

  • Argo CD installed on your Kubernetes cluster.
  • Admin access to a Slack Workspace.
  • kubectl access to your cluster.

1. Configure Slack App & Bot Token

We need to create a β€œBot” user that Argo CD can use to post messages.
  1. Go to Slack API: Your Apps.
  2. Click Create New App > From Scratch.
  3. Name it β€œArgoCD” and select your workspace.
  4. In the left sidebar, go to OAuth & Permissions.
  5. Scroll down to Scopes > Bot Token Scopes and add the following permission:
  • chat:write (Required to send messages)
  • chat:write.customize (Optional: Allows changing username/icon dynamically)
  1. Scroll up to the top of the page and click Install to Workspace.
  2. Copy the Bot User OAuth Token (starts with xoxb-...).

⚠️ Important: Invite the Bot

For the bot to post in a channel, it must be a member of that channel.
  • Go to your target Slack channel (e.g., #jenkins-ntfy).
  • Type /invite @ArgoCD and hit Enter.

2. Create the Kubernetes Secret (Safely)

We must store the Slack token in a Kubernetes Secret. CRITICAL: We use echo -n to prevent hidden newline characters (\n) from breaking the configuration. Run this command in your terminal (replace xoxb-YOUR-TOKEN with your actual token):

3. Configure Argo CD Notifications

We will configure the argocd-notifications-cm ConfigMap. This defines Service, Triggers, Subscriptions, and the Message Templates.

Features of this Configuration:

  • Rich Formatting: Uses Slack Attachments for a professional β€œCloudWatch” look.
  • Detailed Info: Lists Repo URL, Commit SHA, and Sync Status.
  • Resource List: loops through changed objects (e.g., Service my-svc -> configured) so developers see exactly what changed.
  • Deep Links: Clickable titles take you directly to the Argo CD dashboard.

πŸ“„ argocd-notifications-cm.yaml

Save the following content to a file named argocd-notifications-cm.yaml. **Update the argocdUrl** at the top with your actual Argo CD domain.

4. Apply and Restart

Apply the configuration and restart the controller to force it to reload the settings.

5. Verification

  1. Check the logs to ensure no YAML errors:
  1. Go to the Argo CD UI.
  2. Click Sync on any application.
  3. Check your Slack channel. You should see a detailed card listing the sync status and the specific objects (Pods/Services) that were updated.

πŸ”§ Troubleshooting Guide (Common Issues)



ArgoSecret.yaml
ArgoCM.yaml
Restart Services