Ingress-Nginx-Dashboard
1,210

Created 1/9/2024
Updated 7/10/2024
Revision 1
Grafana Version >=10.2.3
Datasources
Prometheus

编辑 ingress service 服务yaml

#Edit ingress service.yaml

metadata:
 annotations:
  # 添加如下两行配置
  # Add the following two lines of code
     prometheus.io/port: "10254"
     prometheus.io/scrape: "true"
spec:
     type: ClusterIP
     ports:
       # 添加如下三行配置
       # Add the following three lines of code
           - name: prometheus
             port: 10254
             targetPort: prometheus

编辑 ingress deployment.yaml 配置

#Edit ingerss deployment.yaml

 ports:
     #在 ports 添加 - name: prometheus  containerPort: 10254
     # In the ports add  - name: prometheus  containerPort: 10254
     - name: prometheus 
       containerPort: 10254

编辑 Prometheus 配置文件增加这个 job

#Edit prometheus.yml Add this job

- job_name: 'ingress-nginx-endpoints'
  kubernetes_sd_configs:
  - role: pod
    namespaces:
      names:
      - ingress-nginx
  relabel_configs:
  - source_labels: [__meta_kubernetes_pod_container_port_number]
    action: keep
    regex: "10254"
  - 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

restart prometheus

Get Dashboard
Download
Copy to Clipboard
Source Grafana.com

Used Metrics 12

  • nginx_ingress_controller_requests

  • s

  • nginx_ingress_controller_nginx_process_connections

  • nginx_ingress_controller_request_duration_seconds_bucket

  • url

  • host

  • path

  • nginx_ingress_controller_request_size_sum

  • nginx_ingress_controller_response_size_sum

  • __interval:

  • nginx_ingress_controller_nginx_process_resident_memory_bytes

  • nginx_ingress_controller_nginx_process_cpu_seconds_total