prometheus-operator / kube-prometheus

Use Prometheus to monitor Kubernetes and applications running on Kubernetes
https://prometheus-operator.dev/
Apache License 2.0
6.66k stars 1.92k forks source link

How to set preferred_ip_protocol:ip4 in probe CRD #1933

Open erictarrence opened 1 year ago

erictarrence commented 1 year ago

Right now my website is only accessible via ipv4 protocol, but looked at manifests/setup/0probeCustomResourceDefinition.yaml and https://docs.okd.io/4.11/rest_api/monitoring_apis/probe-monitoring-coreos-com-v1.html#spec-prober

None of the related parameters of preferred_ip_protocol:ip4 were found

Manual testing failed multiple times,The system prompts preferred_ip_protocol: There is a problem with the "ip4" parameter setting

cat block-probe-http.yaml 
apiVersion: monitoring.coreos.com/v1
kind: Probe
metadata:
  labels:
    app.kubernetes.io/component: exporter
    app.kubernetes.io/name: blackbox-exporter
    app.kubernetes.io/part-of: kube-prometheus
    app.kubernetes.io/version: 0.19.0
  name: blackbox-http
  namespace: monitoring
spec:
  module: http_2xx
  prober:
    url: blackbox-exporter.monitoring.svc:19115
  preferred_ip_protocol: "ip4"
  targets:
    staticConfig:
      static:
      - http://10.23.20.1:6443/
      - https://www.google.com
error: error validating "block-probe-http.yaml": error validating data: ValidationError(Probe.spec): unknown field "preferred_ip_protocol" in com.coreos.monitoring.v1.Probe.spec; if you choose to ignore these errors, turn validation off with --validate=false
paulfantom commented 1 year ago

preferred_ip_protocol is a global setting of a blackbox_exporter and as such it is not configurable on Probe level. You need to configure it with blackbox_exporter configuration file - https://github.com/prometheus-operator/kube-prometheus/blob/main/manifests/blackboxExporter-configuration.yaml#L12