agones.dev/agones@v1.54.0/build/prometheus.yaml (about)

     1  ---
     2  alertmanager:
     3    enabled: false
     4  nodeExporter:
     5    enabled: false
     6  kubeStateMetrics:
     7    enabled: false
     8  pushgateway:
     9    enabled: false
    10  server:
    11    resources:
    12      requests:
    13        memory: 4Gi
    14        cpu: 2
    15    tolerations:
    16      - key: agones.dev/agones-metrics
    17        operator: Equal
    18        value: 'true'
    19        effect: NoExecute
    20    affinity:
    21      nodeAffinity:
    22        preferredDuringSchedulingIgnoredDuringExecution:
    23          - weight: 1
    24            preference:
    25              matchExpressions:
    26                - key: agones.dev/agones-metrics
    27                  operator: Exists
    28  serverFiles:
    29    prometheus.yml:
    30      rule_files: [/etc/config/rules, /etc/config/alerts]
    31      scrape_configs:
    32        - job_name: prometheus
    33          static_configs:
    34            - targets:
    35                - localhost:9090
    36  
    37        # A scrape configuration for running Prometheus on a Kubernetes cluster.
    38        # This uses separate scrape configs for cluster components (i.e. API server, node)
    39        # and services to allow each to use different authentication configs.
    40        #
    41        # Kubernetes labels will be added as Prometheus labels on metrics via the
    42        # `labelmap` relabeling action.
    43  
    44        # Scrape config for API servers.
    45        #
    46        # Kubernetes exposes API servers as endpoints to the default/kubernetes
    47        # service so this uses `endpoints` role and uses relabelling to only keep
    48        # the endpoints associated with the default/kubernetes service using the
    49        # default named port `https`. This works for single API server deployments as
    50        # well as HA API server deployments.
    51        - job_name: kubernetes-apiservers
    52          kubernetes_sd_configs:
    53            - role: endpoints
    54  
    55          # Default to scraping over https. If required, just disable this or change to
    56          # `http`.
    57          scheme: https
    58  
    59          # This TLS & bearer token file config is used to connect to the actual scrape
    60          # endpoints for cluster components. This is separate to discovery auth
    61          # configuration because discovery & scraping are two separate concerns in
    62          # Prometheus. The discovery auth config is automatic if Prometheus runs inside
    63          # the cluster. Otherwise, more config options have to be provided within the
    64          # <kubernetes_sd_config>.
    65          tls_config:
    66            ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
    67            # If your node certificates are self-signed or use a different CA to the
    68            # Kubernetes control plane CA, then disable certificate verification below. Note that
    69            # certificate verification is an integral part of a secure infrastructure
    70            # so this should only be disabled in a controlled environment. You can
    71            # disable certificate verification by uncommenting the line below.
    72            #
    73            insecure_skip_verify: true
    74          bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
    75  
    76          # Keep only the default/kubernetes service endpoints for the https port. This
    77          # will add targets for each API server which Kubernetes adds an endpoint to
    78          # the default/kubernetes service.
    79          relabel_configs:
    80            - source_labels:
    81                - __meta_kubernetes_namespace
    82                - __meta_kubernetes_service_name
    83                - __meta_kubernetes_endpoint_port_name
    84              action: keep
    85              regex: default;kubernetes;https
    86  
    87        # Example scrape config for pods
    88        #
    89        # The relabeling allows the actual pod scrape endpoint to be configured via the
    90        # following annotations:
    91        #
    92        # * `prometheus.io/scrape`: Only scrape pods that have a value of `true`
    93        # * `prometheus.io/path`: If the metrics path is not `/metrics` override this.
    94        # * `prometheus.io/port`: Scrape the pod on the indicated port instead of the default of `9102`.
    95        - job_name: kubernetes-pods
    96          kubernetes_sd_configs:
    97            - role: pod
    98          relabel_configs:
    99            - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
   100              action: keep
   101              regex: true
   102            - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
   103              action: replace
   104              target_label: __metrics_path__
   105              regex: (.+)
   106            - source_labels:
   107                - __address__
   108                - __meta_kubernetes_pod_annotation_prometheus_io_port
   109              action: replace
   110              regex: ([^:]+)(?::\d+)?;(\d+)
   111              replacement: $1:$2
   112              target_label: __address__
   113            - action: labelmap
   114              regex: __meta_kubernetes_pod_label_(.+)
   115            - source_labels: [__meta_kubernetes_namespace]
   116              action: replace
   117              target_label: kubernetes_namespace
   118            - source_labels: [__meta_kubernetes_pod_name]
   119              action: replace
   120              target_label: kubernetes_pod_name