|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

 

 

posted on 2022-04-01 13:28  yanqi_vip  阅读(47)  评论(0)    收藏  举报

导航