Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tls_config & basic_auth not added to Prometheus configs (endpoints) #5143

Closed
mark-brzozowski opened this Issue Jan 28, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@mark-brzozowski
Copy link

mark-brzozowski commented Jan 28, 2019

Bug Report

What did you do?
Add tls_config and basic_auth settings

What did you expect to see?
I expected to see tls_config and basic_auth settings added when viewing my prometheus /config page.

What did you see instead? Under which circumstances?
These values were missing

Environment

  • System information:

    insert output of uname -srm here

  • Prometheus version:
    2.2.1

  • Alertmanager version:
    0.14.0

  • Prometheus configuration file:

---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: wapi-svc-monitor
  namespace: monitoring
  labels:
    serviceMonitorLabels:
      team: coretech
spec:
  selector:
    matchLabels:
      app: wapi-service
  namespaceSelector:
    matchNames:
    - default
  endpoints:
  - port: wapi-svc-port
    path: /webapi-platform/metrics
    scrape_interval: 12s
    scheme: https
    basic_auth:
      username: metrics
      password: password
    tls_config:
      insecure_skip_verify: true
    static_configs:
    - targets: 'wapi-service:443'
    kubernetes_sd_configs:
    - api_servers:
      tls_config:
        insecure_skip_verify: true

==================

values.yaml

...
      enableMonitoring: true
##supportPrometheusRuleCRD specifies if PrometheusRule CRD is supported by the Prometheus Operator.
##PrometheusRule CRD is supported from Prometheus-Operator-v0.21.0 onwards.
##This property is provided only for backward compatibility of Prometheus-Operator
    supportPrometheusRuleCRD: true
    namespace: monitoring
    serviceMonitorLabels:
      team: coretech
    prometheusRulesLabels:
      prometheus: prometheus
      role: alert-rules
  alertConfigurations:
    invalidRequestsDefaultBackend:
      timeRange: 10m
      countThreshold: 0

=====================
Prometheus Service Monitor

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: pushgateway-svc-monitor
  namespace: monitoring
  labels:
    team: coretech
spec:
  selector:
    matchLabels:
      app: prometheus-pushgateway
  namespaceSelector:
    matchNames:
    - monitoring
  endpoints:
  - port: http
  • Logs:
    From the Prometheus /config file:
- job_name: monitoring/wapi-svc-monitor/0
  scrape_interval: 11s
  scrape_timeout: 10s
  **metrics_path: /webapi-platform/metrics
  scheme: https ####Where is the rest? **
  kubernetes_sd_configs:
  - api_server: null
    role: endpoints
    namespaces:
      names:
      - default
  relabel_configs:
  - source_labels: [__meta_kubernetes_service_label_app]
    separator: ;
    regex: wapi-service
    replacement: $1
    action: keep
  - source_labels: [__meta_kubernetes_endpoint_port_name]
    separator: ;
    regex: wapi-svc-port
    replacement: $1
    action: keep
  - source_labels: [__meta_kubernetes_namespace]
    separator: ;
    regex: (.*)
    target_label: namespace
    replacement: $1
    action: replace
  - source_labels: [__meta_kubernetes_pod_name]
    separator: ;
    regex: (.*)
    target_label: pod
    replacement: $1
    action: replace
  - source_labels: [__meta_kubernetes_service_name]
    separator: ;
    regex: (.*)
    target_label: service
    replacement: $1
    action: replace
  - source_labels: [__meta_kubernetes_service_name]
    separator: ;
    regex: (.*)
    target_label: job
    replacement: ${1}
    action: replace
  - separator: ;
    regex: (.*)
    target_label: endpoint
    replacement: wapi-svc-port
    action: replace

Edited by @simonpasquier to fix the formatting.

@simonpasquier

This comment has been minimized.

Copy link
Member

simonpasquier commented Feb 1, 2019

This is more a question for the Prometheus operator. Anyway it looks like you're mixing up Prometheus configuration fields with Prometheus operator's CRD fields. IIUC tls_config should be tlsConfig, basic_auth should be basicAuth, ... See https://coreos.com/operators/prometheus/docs/latest/api.html#endpoint.

I'm closing it for now. If you have further questions, please use our user mailing list, which you can also search.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.