Skip to content

NAIS Alert example YAML

This is a complete example of an Alert resource, commonly known as the alert.yaml file.

For an in-depth explanation of each field, head over to the reference documentation.

apiVersion: nais.io/v1
kind: Alert
metadata:
  creationTimestamp: null
  labels:
    team: myteam
  name: myalert
  namespace: myteam
spec:
  alerts:
  - action: kubectl describe pod {{ $labels.kubernetes_pod_name }} -n {{ $labels.kubernetes_namespace
      }}` for events, og `kubectl logs {{ $labels.kubernetes_pod_name }} -n {{ $labels.kubernetes_namespace
      }}` for logger
    alert: applikasjon nede
    description: App {{ $labels.app }} er nede i namespace {{ $labels.kubernetes_namespace
      }}
    documentation: https://doc.nais.io/observability/alerts/
    expr: kube_deployment_status_replicas_available{deployment="<appname>"} > 0
    for: 2m
    priority: "0"
    severity: danger
    sla: Mellom 8 og 16
  inhibitRules:
  - labels:
    - label
    - lebal
    sources:
      key: value
    sourcesRegex:
      key: value(.)?
    targets:
      key: value
    targetsRegex:
      key: value(.)+
  receivers:
    email:
      to: myteam@nav.no
    slack:
      channel: '#alert-channel'
      icon_emoji: ':chart_with_upwards_trend:'
      icon_url: http://lorempixel.com/48/48
      prependText: Oh noes!
      send_resolved: true
      username: Alertmanager
    sms:
      recipients: "12345678"
      send_resolved: false
  route:
    group_by:
    - <label_name>
    groupInterval: 5m
    groupWait: 30s
    repeatInterval: 3h
status: {}