|NO.Z.00361|——————————|CloudNative|——|KuberNetes&运维.V77|——|IngressNginx.v13|监控|
一、IngressNginx监控
### --- IngressNginx监控
~~~ # IngressNginx监控官网地址:
~~~ https://kubernetes.github.io/ingress-nginx/user-guide/monitoring/

二、ingress nginx 监控配置:https://github.com/kubernetes/ingress-nginx/tree/master/deploy

三、实验环境配置
### --- 查看pod自动发现配置
~~~ 查看daemonset自动发现配置
[root@k8s-master01 ~]# kubectl edit ds -n ingress-nginx ingress-nginx-controller
annotations:
prometheus.io/port: "10254"
prometheus.io/scrape: "true"
### --- 查看pod自动发现配置
~~~ 均开启了自动发现的annotations,端口为10254
~~~ 告诉了Prometheus是可以被自动发现的
[root@k8s-master01 Ingressnginx监控]# kubectl get po -n ingress-nginx ingress-nginx-controller-7lpqc -oyaml
annotations:
prometheus.io/port: "10254"
prometheus.io/scrape: "true"
四、配置secrets
### --- 配置secrets
~~~ ——>http://krm.test.com/——>secrets——>Namespace:monitoring
~~~ ——>additional-scrape-configs——>编辑:最下面添加如下内容——>update——>END
- job_name: 'ingress-nginx-endpoints'
kubernetes_sd_configs:
- role: pod
namespaces:
names:
- ingress-nginx
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep
regex: true
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scheme]
action: replace
target_label: __scheme__
regex: (https?)
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
action: replace
target_label: __metrics_path__
regex: (.+)
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
action: replace
target_label: __address__
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:$2
- source_labels: [__meta_kubernetes_service_name]
regex: prometheus-server
action: drop
### --- 通过浏览器访问查看:http://prom.test.com/——>status:targets——>均监控到
~~~ ——>查看Ingress的监控信息——>Alerts——>Enable query history:ingress
~~~ ——>获取监控数据——>END

五、配置dashboard
### --- 配置dashboard
~~~ # dashboard下载地址
~~~ https://github.com/kubernetes/ingress-nginx/tree/master/deploy/grafana/dashboards
### --- 导入dashboard
~~~ ——>http://grafana.test.com/——>+号——>Import
~~~ ——>Upload.json file:nginx.json、request-handling-performance.json
~~~ ——>Prometheus:Prometheus——>Import——>END
~~~ ——>dashboard——1:nginx.json——>END
~~~ ——>dashboard——2:request-handling-performance.json


Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
——W.S.Landor
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)