kube-prometheus: expand the minikube.jsonnet example
This commit is contained in:
23
README.md
23
README.md
@@ -383,31 +383,10 @@ See [exposing Prometheus/Alertmanager/Grafana](docs/exposing-prometheus-alertman
|
||||
|
||||
## Minikube Example
|
||||
|
||||
To use an easy to reproduce example, let's take the minikube setup as demonstrated in [Prerequisites](#prerequisites). It is a kubeadm cluster (as we use the kubeadm bootstrapper) and because we would like easy access to our Prometheus, Alertmanager and Grafana UI we want the services to be exposed as NodePort type services:
|
||||
To use an easy to reproduce example, see [minikube.jsonnet](examples/minikube.jsonnet), which uses the minikube setup as demonstrated in [Prerequisites](#prerequisites). Because we would like easy access to our Prometheus, Alertmanager and Grafana UIs, `minikube.jsonnet` exposes the services as NodePort type services.
|
||||
|
||||
> Note that NodePort type services is likely not a good idea for your production use case, it is only used for demonstration purposes here.
|
||||
|
||||
[embedmd]:# (examples/minikube.jsonnet)
|
||||
```jsonnet
|
||||
local kp =
|
||||
(import 'kube-prometheus/kube-prometheus.libsonnet') +
|
||||
(import 'kube-prometheus/kube-prometheus-kubeadm.libsonnet') +
|
||||
(import 'kube-prometheus/kube-prometheus-node-ports.libsonnet') +
|
||||
{
|
||||
_config+:: {
|
||||
namespace: 'monitoring',
|
||||
},
|
||||
};
|
||||
|
||||
{ ['00namespace-' + name]: kp.kubePrometheus[name] for name in std.objectFields(kp.kubePrometheus) } +
|
||||
{ ['0prometheus-operator-' + name]: kp.prometheusOperator[name] for name in std.objectFields(kp.prometheusOperator) } +
|
||||
{ ['node-exporter-' + name]: kp.nodeExporter[name] for name in std.objectFields(kp.nodeExporter) } +
|
||||
{ ['kube-state-metrics-' + name]: kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics) } +
|
||||
{ ['alertmanager-' + name]: kp.alertmanager[name] for name in std.objectFields(kp.alertmanager) } +
|
||||
{ ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } +
|
||||
{ ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) }
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Error retrieving kubelet metrics
|
||||
|
@@ -5,6 +5,47 @@ local kp =
|
||||
{
|
||||
_config+:: {
|
||||
namespace: 'monitoring',
|
||||
alertmanager+:: {
|
||||
config: importstr 'alertmanager-config.yaml',
|
||||
},
|
||||
grafana+:: {
|
||||
config: {
|
||||
sections: {
|
||||
// Do not require grafana users to login/authenticate
|
||||
"auth.anonymous": {enabled: true},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// For simplicity, each of the following values for 'externalUrl':
|
||||
// * assume that `minikube ip` prints "192.168.99.100"
|
||||
// * hard-code the NodePort for each app
|
||||
prometheus+:: {
|
||||
prometheus+: {
|
||||
// Reference info: https://coreos.com/operators/prometheus/docs/latest/api.html#prometheusspec
|
||||
spec+: {
|
||||
// An e.g. of the purpose of this is so the "Source" links on http://<alert-manager>/#/alerts are valid.
|
||||
externalUrl: "http://192.168.99.100:30900",
|
||||
|
||||
// Reference info: "external_labels" on https://prometheus.io/docs/prometheus/latest/configuration/configuration/
|
||||
externalLabels: {
|
||||
// This 'cluster' label will be included on every firing prometheus alert. (This is more useful
|
||||
// when running multiple clusters in a shared environment (e.g. AWS) with other users.)
|
||||
cluster: "minikube-<INSERT YOUR USERNAME HERE>",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
alertmanager+:: {
|
||||
alertmanager+: {
|
||||
// Reference info: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#alertmanagerspec
|
||||
spec+: {
|
||||
externalUrl: "http://192.168.99.100:30903",
|
||||
|
||||
logLevel: "debug", // So firing alerts show up in log
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user