In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to deploy alertmanager in prometheus13-k8s. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
1. Four Profil
[root@kubemaster01 alertmanager] # root root Oct 28 15:43 alertmanager-configmap.yaml-rw-r--r-- 1 root root 2183 Oct 28 15:36 alertmanager-deployment.yaml-rw-r--r-- 1 root root 331 Oct 28 15:36 alertmanager-pvc.yaml-rw-r--r-- 1 root root 372 Oct 28 15:36 alertmanager-service.yaml
two。 Modify the address of pv and config
[root@kubemaster01 alertmanager] # cat alertmanager-pvc.yaml apiVersion: v1kind: PersistentVolumeClaimmetadata: name: alertmanager namespace: kube-system labels: kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: EnsureExistsspec: storageClassName: managed-nfs-storage accessModes:-ReadWriteOnce resources: requests: storage: "2Gi" [root@kubemaster01 alertmanager] # cat alertmanager-configmap.yaml apiVersion: v1kind: ConfigMapmetadata: name: alertmanager-config namespace: kube-system labels: Kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: EnsureExistsdata: alertmanager.yml: | global: resolve_timeout: 5m smtp_smarthost: 'smtp.163.com:25' smtp_from:' ww763004768@163.com' smtp_auth_username: 'ww763004768@163.com' smtp_auth_password:' 123456' smtp_require_tls: false receivers:-name: Default-receiver email_configs:-to: "w673004768@163.com" route: group_interval: 1m group_wait: 10s receiver: default-receiver repeat_interval: 1m [root@kubemaster01 alertmanager] #
3. Deployment
Kubectl apply-f alertmanager-configmap.yamlkubectl apply-f alertmanager-pvc.yamlkubectl apply-f alertmanager-deployment.yamlkubectl apply-f alertmanager-service.yaml
4.Prometheus and alertmanager communication configuration
Modify the configuration of prometheus config-map and then re-apply it
5. Check to see if it is effective
6. Modify configmap to modify the alarm rules of prometheus
(kubectl apply-f prometheus-configmap.yaml)
Create configmap
Kubectl apply-f prometheus-rules.yaml
[root@kubemaster01 prometheus] # cat prometheus-rules.yaml apiVersion: v1kind: ConfigMapmetadata: name: prometheus-rules namespace: kube-systemdata: general.rules: | groups:-name: general.rules rules:-alert: InstanceDown expr: up = = 0 for: 1m labels: severity: error annotations: summary: "Instance {{$labels.instance}} stop working" Description: "{{$labels.instance}} job {{$labels.job}} has been stopped for more than 5 minutes." Node.rules: | groups:-name: node.rules rules:-alert: NodeFilesystemUsage expr: 100-(node_filesystem_free_bytes {fstype=~ "ext4 | xfs"} / node_filesystem_size_bytes {fstype=~ "ext4 | xfs"} * 100) > 80 for: 1m labels: severity: warning annotations: summary: "Instance {{$labels.instance}}: {{$labels. Mountpoint}} partition usage is too high "description:" {{$labels.instance}}: {{$labels.mountpoint}} partition usage is greater than 80% (current value: {{$value}}) "- alert: NodeMemoryUsage expr: 100-(node_memory_MemFree_bytes+node_memory_Cached_bytes+node_memory_Buffers_bytes) / node_memory_MemTotal_bytes * 100 > 80 for: 1m labels: Severity: warning annotations: summary: "Instance {{$labels.instance}} memory usage is too high" description: "{{$labels.instance}} memory usage is greater than 80% (current value: {{$value}})"-alert: NodeCPUUsage expr: 100-(avg (irate (node_cpu_seconds_total {mode= "idle"} [5m])) by (instance) ) * 100) > 60 for: 1m labels: severity: warning annotations: summary: "Instance {{$labels.instance}} CPU utilization is too high" description: "{{$labels.instance}} CPU usage greater than 60% (current value: {{$value}})" [root@kubemaster01 prometheus] #
Prometheus service mounts configmap
This is the end of the article on "how prometheus13-k8s deploys alertmanager". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.