-
Notifications
You must be signed in to change notification settings - Fork 57
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
Configure Prometheus, Grafana, AlertManager to run behind Traefik HTTP Proxy using a subpath #71
Comments
Configuring prometheus and alertmanagerFrom the command line parameters of Prometheus (prometheus -h), there are two options to control the path and route configuration.
Alertmanager has same options. Using PrometheusOperator these options can be configured for both CRDs Configuring these parameters in kube-prometheus-stack chartThese are the values that need to be configured. alertmanager:
alertmanagerSpec:
externalUrl: http://monitoring.picluster.ricsanfre.com/alertmanager/
routePrefix: /
prometheus:
prometheusSpec:
externalUrl: http://monitoring.picluster.ricsanfre.com/prometheus/
routePrefix: / Configuring Traefik IngressTraefik ingress route need to be configured using a stripPrefix middleware, to remove path prefix before sending the request to the backend service. ---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: stripprefix
namespace: monitoring
spec:
stripPrefix:
prefixes:
- "/prometheus"
- "/alertmanager"
forceSlash: false
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: prometheus
namespace: monitoring
spec:
entryPoints:
- web
routes:
- kind: Rule
match: Host(`monitoring.picluster.ricsanfre.com`) && PathPrefix(`/prometheus`)
services:
- name: kube-prometheus-stack-prometheus
port: 9090
namespace: monitoring
middlewares:
- name: stripprefix
namespace: monitoring
- kind: Rule
match: Host(`monitoring.picluster.ricsanfre.com`) && PathPrefix(`/alertmanager`)
services:
- name: kube-prometheus-stack-alertmanager
port: 9093
namespace: monitoring
middlewares:
- name: stripprefix
namespace: monitoring
|
Configuring GrafanaWhen running Grafana behind a proxy, you need to configure the domain name to let Grafana know how to render links and redirects correctly. In the Grafana configuration file, change
Configuring these parameters in kube-prometheus-stack chartWhen deploying grafana subchart from kube-prometheus-stack the following values must be provided: grafana:
grafana.ini:
server:
domain: monitoring.internal
root_url: "%(protocol)s://%(domain)s:%(http_port)s/grafana/"
serve_from_sub_path: true Configuring Traefik IngressTraefik ingress rule to serve Grafana, prometheus and alertmanager from monitor.picluster.ricsanfre.com ---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: stripprefix
namespace: monitoring
spec:
stripPrefix:
prefixes:
- "/prometheus"
- "/alertmanager"
- "/grafana"
forceSlash: false
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: prometheus
namespace: monitoring
spec:
entryPoints:
- web
routes:
- kind: Rule
match: Host(`monitoring.picluster.ricsanfre.com`) && PathPrefix(`/prometheus`)
services:
- name: kube-prometheus-stack-prometheus
port: 9090
namespace: monitoring
middlewares:
- name: stripprefix
namespace: monitoring
- kind: Rule
match: Host(`monitoring.picluster.ricsanfre.com`) && PathPrefix(`/alertmanager`)
services:
- name: kube-prometheus-stack-alertmanager
port: 9093
namespace: monitoring
middlewares:
- name: stripprefix
namespace: monitoring
- kind: Rule
match: Host(`monitoring.picluster.ricsanfre.com`) && PathPrefix(`/grafana`)
services:
- name: kube-prometheus-stack-grafana
port: 80
namespace: monitoring
middlewares:
- name: stripprefix
namespace: monitoring |
Feature request
Configure Prometheus, Alertmanager and Grafana to run behind Traefik HTTP Proxy using a subpath making them available at
https://monitoring.picluster.ricsanfre/grafana
,https://monitoring.picluster.ricsanfre/prometheus
andhttps://monitoring.picluster.ricsanfre/alertmanager
instead of using separate domains for each component.References
The text was updated successfully, but these errors were encountered: