본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Grafana 알림 서비스 (Grafana Notification Service)

원문 보기 위키 갱신

Argo Rollouts의 알림(notification)에 Grafana annotation을 사용하는 방법을 알아보겠습니다. Grafana에 API Key를 만들고, ConfigMap과 Secret으로 알림 설정을 구성하며, 템플릿과 구독을 정의하는 과정을 살펴봅니다.

출처: Argo Rollouts 문서

본문

argocd-notifications로 Grafana annotation을 생성하려면 Grafana 안에 API Key를 만들어야 합니다.

사용 가능한 파라미터는 다음과 같습니다.

  • apiURL - 서버 URL, 예: https://grafana.example.com

  • apiKey - serviceaccount용 API key

  • insecureSkipVerify - 선택 사항, true 또는 false의 bool

  • maxIdleConns - 선택 사항, 모든 호스트에 걸친 최대 idle(keep-alive) 연결 수

  • maxIdleConnsPerHost - 선택 사항, 호스트당 최대 idle(keep-alive) 연결 수

  • maxConnsPerHost - 선택 사항, 호스트당 최대 총 연결 수

  • idleConnTimeout - 선택 사항, idle(keep-alive) 연결이 닫히기 전에 열려 있을 최대 시간

  • Grafana 인스턴스에 admin으로 로그인합니다.

  • 왼쪽 메뉴에서 Configuration / API Keys로 이동합니다.

  • "Add API Key"를 클릭합니다.

  • 이름 ArgoCD Notification, 역할 Editor, Time to Live 10y(예시)로 Key를 채웁니다.

  • Add 버튼을 클릭합니다.

  • API Key를 복사하고 argo-rollouts-notification-secret Secret에 apiKey를 저장한 뒤, argo-rollouts-notification-configmap ConfigMap에 정의합니다.

apiVersion: v1
kind: ConfigMap
metadata:
  name: argo-rollouts-notification-configmap
data:
  service.grafana: |
    apiUrl: https://grafana.example.com/api
    apiKey: ***
apiVersion: v1
kind: Secret
metadata:
  name: <secret-name>
stringData:
  grafana-api-key: ***
  1. argo-notifications-cm Configmap에 템플릿을 생성합니다. 이것은 annotation의 (필수) 텍스트를 Grafana에 전달하는 데 사용됩니다(또는 기존 템플릿을 재사용합니다). Grafana용 특정 템플릿이 없으므로 일반적인 message를 사용해야 합니다.
apiVersion: v1
kind: ConfigMap
metadata:
  name: argo-rollouts-notification-configmap
data:
  templates:
    template.app-deployed: |
      message: Application {{.app.metadata.name}} is now running new version of deployments manifests.
  1. Grafana 통합에 대한 구독(subscription)을 생성합니다.
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  annotations:
    notifications.argoproj.io/subscribe.<trigger-name>.grafana: tag1|tag2 # list of tags separated with |
  1. annotations 설정을 변경합니다.

더 알아보기 (Learn more)

  • Argo Rollouts 알림(Notification) 설정 개요
  • 알림 템플릿(template)과 트리거(trigger) 개념
  • Kubernetes Secret & ConfigMap으로 알림 자격 증명 관리
  • Slack, Rocket.Chat 등 다른 알림 서비스 연동