squash! Update README defaults and config
This commit is contained in:
97
README.md
97
README.md
@@ -329,98 +329,19 @@ Once updated, just follow the instructions under "Compiling" and "Apply the kube
|
||||
|
||||
Jsonnet has the concept of hidden fields. These are fields, that are not going to be rendered in a result. This is used to configure the kube-prometheus components in jsonnet. In the example jsonnet code of the above [Customizing Kube-Prometheus section](#customizing-kube-prometheus), you can see an example of this, where the `namespace` is being configured to be `monitoring`. In order to not override the whole object, use the `+::` construct of jsonnet, to merge objects, this way you can override individual settings, but retain all other settings and defaults.
|
||||
|
||||
These are the available fields with their respective default values:
|
||||
The available fields and their default values can be seen in [main.libsonnet](jsonnet/kube-prometheus/main.libsonnet). Note that many of the fields get their default values from variables, and for example the version numbers are imported from [versions.json](jsonnet/kube-prometheus/versions.json).
|
||||
|
||||
Configuration is mainly done in the `values` map. You can see this being used in the `example.jsonnet` to set the namespace to `monitoring`. This is done in the `common` field, which all other components take their default value from. See for example how Alertmanager is configured in `main.libsonnet`:
|
||||
|
||||
```
|
||||
{
|
||||
values:: {
|
||||
common: {
|
||||
namespace: 'default',
|
||||
ruleLabels: {
|
||||
role: 'alert-rules',
|
||||
prometheus: $.values.prometheus.name,
|
||||
},
|
||||
// to allow automatic upgrades of components, we store versions in autogenerated `versions.json` file and import it here
|
||||
versions: {
|
||||
alertmanager: error 'must provide version',
|
||||
blackboxExporter: error 'must provide version',
|
||||
grafana: error 'must provide version',
|
||||
kubeStateMetrics: '1.9.8',
|
||||
nodeExporter: error 'must provide version',
|
||||
prometheus: error 'must provide version',
|
||||
prometheusAdapter: error 'must provide version',
|
||||
prometheusOperator: error 'must provide version',
|
||||
} + (import 'versions.json'),
|
||||
images: {
|
||||
alertmanager: 'quay.io/prometheus/alertmanager:v' + $.values.common.versions.alertmanager,
|
||||
blackboxExporter: 'quay.io/prometheus/blackbox-exporter:v' + $.values.common.versions.blackboxExporter,
|
||||
grafana: 'grafana/grafana:v' + $.values.common.versions.grafana,
|
||||
kubeStateMetrics: 'k8s.gcr.io/kube-state-metrics/kube-state-metrics:v' + $.values.common.versions.kubeStateMetrics,
|
||||
nodeExporter: 'quay.io/prometheus/node-exporter:v' + $.values.common.versions.nodeExporter,
|
||||
prometheus: 'quay.io/prometheus/prometheus:v' + $.values.common.versions.prometheus,
|
||||
prometheusAdapter: 'directxman12/k8s-prometheus-adapter:v' + $.values.common.versions.prometheusAdapter,
|
||||
prometheusOperator: 'quay.io/prometheus-operator/prometheus-operator:v' + $.values.common.versions.prometheusOperator,
|
||||
prometheusOperatorReloader: 'quay.io/prometheus-operator/prometheus-config-reloader:v' + $.values.common.versions.prometheusOperator,
|
||||
},
|
||||
},
|
||||
alertmanager: {
|
||||
name: 'main',
|
||||
config: |||
|
||||
global:
|
||||
resolve_timeout: 5m
|
||||
inhibit_rules:
|
||||
- source_match:
|
||||
severity: critical
|
||||
target_match_re:
|
||||
severity: warning|info
|
||||
equal: ['namespace', 'alertname']
|
||||
- source_match:
|
||||
severity: warning
|
||||
target_match_re:
|
||||
severity: info
|
||||
equal: ['namespace', 'alertname']
|
||||
route:
|
||||
group_by: ['namespace']
|
||||
group_wait: 30s
|
||||
group_interval: 5m
|
||||
repeat_interval: 12h
|
||||
receiver: 'Default'
|
||||
routes:
|
||||
- match:
|
||||
alertname: Watchdog
|
||||
receiver: Watchdog
|
||||
- match:
|
||||
severity: critical
|
||||
receiver: Critical
|
||||
receivers:
|
||||
- name: Default
|
||||
- name: Watchdog
|
||||
- name: Critical
|
||||
|||,
|
||||
replicas: 3
|
||||
// Use the namespace specified under values.common by default.
|
||||
namespace: $.values.common.namespace,
|
||||
version: $.values.common.versions.alertmanager,
|
||||
image: $.values.common.images.alertmanager,
|
||||
mixin+: { ruleLabels: $.values.common.ruleLabels },
|
||||
},
|
||||
kubeStateMetrics: {
|
||||
resources: {
|
||||
requests: { cpu: '10m', memory: '190Mi' },
|
||||
limits: { cpu: '100m', memory: '250Mi' },
|
||||
},
|
||||
scrapeInterval: '30s',
|
||||
scrapeTimeout: '30s',
|
||||
},
|
||||
nodeExporter: {
|
||||
listenAddress: '127.0.0.1',
|
||||
port: 9100,
|
||||
resources: {
|
||||
requests: { cpu: '102m', memory: '180Mi' },
|
||||
limits: { cpu: '250m', memory: '180Mi' },
|
||||
},
|
||||
},
|
||||
prometheus: {
|
||||
name: 'k8s',
|
||||
replicas: 2,
|
||||
resources: { memory: '400Mi' }
|
||||
},
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The grafana definition is located in a different project (https://github.com/brancz/kubernetes-grafana), but needed configuration can be customized from the same top level `values` field. For example to allow anonymous access to grafana, add the following `values` section:
|
||||
|
||||
Reference in New Issue
Block a user