Ingress-Nginx-Dashboard

Kubernetes Ingress-Nginx-Dashboard

Ingress-Nginx-Dashboard screenshot 1

编辑 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

Revisions
RevisionDescriptionCreated
NGINX

NGINX

by Grafana Labs
Grafana Labs solution

Easily monitor NGINX, an open source software for web serving, reverse proxying, caching, load balancing, media streaming, and more, with Grafana Cloud's out-of-the-box monitoring solution.

Learn more

Get this dashboard

Import the dashboard template

or

Download JSON

Datasource
Dependencies