← All dashboards

Ingress-Nginx-Dashboard

Kubernetes Ingress-Nginx-Dashboard

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

Dashboard revisions

RevisionDecscriptionCreated

Reviews

Login or Sign up to write a review

Reviews from the community

Get this dashboard

Data source:

Dependencies:

Import the dashboard template:

or

Download JSON

Docs: Importing dashboards

Downloads: 11