k8s部署webhookdingtalk

k8s部署webhookdingtalk

   运维菜鸟     2022年9月21日 20:37     43    

1、编写dingtalk config的文件

dingtalk-config.yaml

dingtalk-config.txt


2、编写dingtalk的template的yaml文件,生成configmap

dingtalk-template.yaml

dingtalk-template.txt


3、编写deployment文件

dingtalk-deployment.yaml

dingtalk-deployment.txt


4、新增service文件

dingtalk-service.yaml

dingtalk-service.txt


执行上述文件

kubectl apply -f dingtalk-config.yaml

kubectl apply -f dingtalk-template.yaml

kubectl apply -f dingtalk-deployment.yaml

kubectl apply -f dingtalk-service.yaml


5、配置alertmanager

在manifests中的alertmanager-secret.yaml

apiVersion: v1

kind: Secret

metadata:

  name: alertmanager-main

  namespace: monitoring

stringData:

  alertmanager.yaml: |-

    global:

      resolve_timeout: 5m

    route:

      group_by: ['alertname']

      group_wait: 10s

      group_interval: 10s

      repeat_interval: 6h

      receiver: 'webhook'

    receivers:

    - name: 'webhook'

      webhook_configs:

      - send_resolved: true

        url: 'http://webhook-dingtalk:8060/dingtalk/webhook/send'

    inhibit_rules:

      - source_match:

          severity: 'critical'

        target_match:

          severity: 'warning'

        equal: ['alertname', 'dev', 'instance']

type: Opaque


kubectl apply -f alertmanager-secret.yaml


6、配置告警规则

在manifests中的prometheus-rules.yaml进行配置。

kubectl apply -f prometheus-rules.yaml

文章评论

0

其他文章