EKS部署higress网关

58 阅读1分钟

EKS部署higress网关

helm部署

# 添加helm仓库
helm repo add higress.io https://higress.io/helm-charts
# 查看values配置
helm show values higress.io/higress
# 安装
helm install higress --version 2.1.6 -n higress-system higress.io/higress -f values.yaml
# 更新
helm upgrade higress --version 2.1.6 -n higress-system higress.io/higress -f values.yaml
# 卸载
helm uninstall higress -n higress-system

values文件

global:
  # 是否开启内置监控
  # o11y:
  #   enabled: true
  enableProxyProtocol: true # 开启代理协议
higress-console:
  service:
    type: NodePort
higress-core:
  gateway:
    annotations:
      service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
      service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
      service.beta.kubernetes.io/aws-load-balancer-type: nlb
      service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*" # 开启代理协议版本 2

    metrics:
      # 开启 PodMonitor
      enabled: true

      # 使用 Prometheus Operator 的 PodMonitor
      provider: monitoring.coreos.com

      # 抓取间隔与标签策略
      interval: 15s
      honorLabels: false

      # 关键:通过 chart 暴露的键位把 relabelings 渲染进 PodMonitor.spec.podMetricsEndpoints[].relabelings
      relabelings:
        # 可选:映射 Pod 上的所有标签到指标标签
        - action: labelmap
          regex: __meta_kubernetes_pod_label_(.+)

        # 如使用注解控制抓取(可选,若你的 Pod 上打了这些注解)
        - action: keep
          sourceLabels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
          regex: "true"
        - action: replace
          sourceLabels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
          targetLabel: __metrics_path__
          regex: (.+)

        # 关键:把注解端口写回 __address__,确保能抓到 Envoy 管理端口
        - action: replace
          sourceLabels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
          regex: ([^:]+)(?::\d+)?;(\d+)
          replacement: $1:$2
          targetLabel: __address__

        # 常用:补充命名空间/Pod 名到指标标签
        - action: replace
          sourceLabels: [__meta_kubernetes_namespace]
          targetLabel: kubernetes_namespace
        - action: replace
          sourceLabels: [__meta_kubernetes_pod_name]
          targetLabel: kubernetes_pod_name

      # 可选:对指标做“入库前”处理(例如丢弃噪声指标或重写名称)
      # metricRelabelings:
      #   - action: drop
      #     sourceLabels: [__name__]
      #     regex: go_.*

      # 用 rawSpec 补充 PodMonitor 其它字段(端口/路径/jobLabel 等)
      # 注意:port 名称必须与网关 Pod/容器实际的“命名端口”一致
      rawSpec:
        jobLabel: app.kubernetes.io/name
        podMetricsEndpoints:
          - port: http-envoy-prom
            path: /stats/prometheus
            interval: 15s
            honorLabels: false