From cfc4a9867bea974823b8bc6a0585afce6153b754 Mon Sep 17 00:00:00 2001 From: Karl Skewes <karl.skewes@gmail.com> Date: Mon, 29 Oct 2018 09:26:20 +1300 Subject: [PATCH] Example jsonnet ingress, update docs with external url --- ...sing-prometheus-alertmanager-grafana-ingress.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/exposing-prometheus-alertmanager-grafana-ingress.md b/docs/exposing-prometheus-alertmanager-grafana-ingress.md index 34213067..68c5795a 100644 --- a/docs/exposing-prometheus-alertmanager-grafana-ingress.md +++ b/docs/exposing-prometheus-alertmanager-grafana-ingress.md @@ -24,7 +24,8 @@ htpasswd -c auth <username> In order to use this a secret needs to be created containing the name of the `htpasswd`, and with annotations on the Ingress object basic auth can be configured. -[embedmd]:# (../examples/ingress.jsonnet) +Also, the applications provide external links to themselves in alerts and various places. When an ingress is used in front of the applications these links need to be based on the external URL's. This can be configured for each application in jsonnet. + ```jsonnet local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; local secret = k.core.v1.secret; @@ -39,6 +40,13 @@ local kp = _config+:: { namespace: 'monitoring', }, + prometheus+:: { + prometheus+: { + spec+: { + externalURL: 'http://prometheus.example.com', + }, + }, + }, ingress+:: { 'prometheus-k8s': ingress.new() + @@ -73,7 +81,7 @@ k.core.v1.list.new([ ]) ``` -In order to expose Alertmanager and Grafana, simply create additional fields containing an ingress object, but simply pointing at the `alertmanager` or `grafana` instead of the `prometheus-k8s` Service. Make sure to also use the correct port respectively, for Alertmanager it is also `web`, for Grafana it is `http`. +In order to expose Alertmanager and Grafana, simply create additional fields containing an ingress object, but simply pointing at the `alertmanager` or `grafana` instead of the `prometheus-k8s` Service. Make sure to also use the correct port respectively, for Alertmanager it is also `web`, for Grafana it is `http`. Be sure to also specify the appropriate external URL. In order to render the ingress objects similar to the other objects use as demonstrated in the [main readme](../README.md#usage): @@ -89,3 +97,5 @@ In order to render the ingress objects similar to the other objects use as demon ``` Note, that in comparison only the last line was added, the rest is identical to the original. + +See (../examples/ingress.jsonnet) for an example implementation. -- GitLab