Added new config to the config generator. Import Grafana dashboards

This commit is contained in:
CarlosEDP 2019-02-04 18:02:26 -02:00
parent 06671c0121
commit 158acde3ac
7 changed files with 3320 additions and 4460 deletions

6
generate_ingress_auth.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo "Run the script with the required auth user and namespace for the secret: ${0} [user] [namespace]"
exit 0
fi
printf "${1}:`openssl passwd -apr1`\n" >> auth

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,53 +1,4 @@
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
},
{
"name": "VAR_SCRAPE_INTERVAL",
"type": "constant",
"label": "Scrape interval seconds",
"value": "60",
"description": ""
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "5.0.0"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": "5.0.0"
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "5.0.0"
},
{
"type": "panel",
"id": "singlestat",
"name": "Singlestat",
"version": "5.0.0"
},
{
"type": "panel",
"id": "text",
"name": "Text",
"version": "5.0.0"
}
],
"annotations": {
"list": [
{
@ -95,8 +46,8 @@
"editable": true,
"gnetId": 3681,
"graphTooltip": 1,
"id": null,
"iteration": 1520350506982,
"id": 13,
"iteration": 1549118131383,
"links": [
{
"icon": "info",
@ -141,7 +92,7 @@
"rgba(237, 129, 40, 0.89)",
"#bf1b00"
],
"datasource": "${DS_PROMETHEUS}",
"datasource": "prometheus",
"decimals": 1,
"format": "s",
"gauge": {
@ -223,7 +174,7 @@
"rgba(237, 129, 40, 0.89)",
"#bf1b00"
],
"datasource": "${DS_PROMETHEUS}",
"datasource": "prometheus",
"format": "short",
"gauge": {
"maxValue": 1000000,
@ -304,7 +255,7 @@
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"datasource": "${DS_PROMETHEUS}",
"datasource": "prometheus",
"format": "none",
"gauge": {
"maxValue": 100,
@ -385,7 +336,7 @@
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"datasource": "${DS_PROMETHEUS}",
"datasource": "prometheus",
"decimals": 2,
"format": "ms",
"gauge": {
@ -483,7 +434,7 @@
"rgba(237, 129, 40, 0.89)",
"#299c46"
],
"datasource": "${DS_PROMETHEUS}",
"datasource": "prometheus",
"decimals": 1,
"format": "none",
"gauge": {
@ -620,6 +571,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Query elapsed time",
"tooltip": {
@ -653,7 +605,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
@ -717,6 +673,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Head series created/deleted",
"tooltip": {
@ -750,7 +707,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
@ -898,6 +859,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Prometheus errors",
"tooltip": {
@ -931,7 +893,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"collapsed": false,
@ -1003,6 +969,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Scrape delay (counts with 1m scrape interval)",
"tooltip": {
@ -1034,7 +1001,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
@ -1096,6 +1067,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Rule evaulation duration",
"tooltip": {
@ -1129,7 +1101,11 @@
"min": "0",
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"collapsed": false,
@ -1200,6 +1176,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Request count",
"tooltip": {
@ -1233,7 +1210,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
@ -1291,6 +1272,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Request duration per handler",
"tooltip": {
@ -1324,7 +1306,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
@ -1380,6 +1366,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Request size by handler",
"tooltip": {
@ -1413,7 +1400,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
@ -1489,6 +1480,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Cont of concurent queries",
"tooltip": {
@ -1522,7 +1514,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"collapsed": false,
@ -1610,6 +1606,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Alert queue size",
"tooltip": {
@ -1643,7 +1640,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
@ -1700,6 +1701,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Count of discovered alertmanagers",
"tooltip": {
@ -1733,7 +1735,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
@ -1801,6 +1807,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Alerting errors",
"tooltip": {
@ -1834,7 +1841,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"collapsed": false,
@ -1855,7 +1866,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"datasource": "prometheus",
"fill": 1,
"gridPos": {
"h": 7,
@ -1897,6 +1908,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Consul SD sync count",
"tooltip": {
@ -1929,14 +1941,18 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"datasource": "prometheus",
"fill": 1,
"gridPos": {
"h": 7,
@ -1978,6 +1994,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Marathon SD sync count",
"tooltip": {
@ -2010,14 +2027,18 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"datasource": "prometheus",
"fill": 1,
"gridPos": {
"h": 7,
@ -2059,6 +2080,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Kubernetes SD sync count",
"tooltip": {
@ -2091,7 +2113,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
@ -2189,6 +2215,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Service discovery errors",
"tooltip": {
@ -2222,7 +2249,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"collapsed": false,
@ -2243,7 +2274,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"datasource": "prometheus",
"fill": 1,
"gridPos": {
"h": 7,
@ -2284,6 +2315,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Reloaded block from disk",
"tooltip": {
@ -2316,7 +2348,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
@ -2373,6 +2409,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Loaded data blocks",
"tooltip": {
@ -2406,7 +2443,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
@ -2463,6 +2504,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Time series total count",
"tooltip": {
@ -2496,7 +2538,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
@ -2548,6 +2594,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Samples Appended per second",
"tooltip": {
@ -2581,7 +2628,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"collapsed": false,
@ -2659,6 +2710,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Head chunks count",
"tooltip": {
@ -2692,14 +2744,18 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"datasource": "prometheus",
"fill": 1,
"gridPos": {
"h": 7,
@ -2740,6 +2796,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Length of head block",
"tooltip": {
@ -2772,7 +2829,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
@ -2834,6 +2895,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Head Chunks Created/Deleted per second",
"tooltip": {
@ -2867,7 +2929,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"collapsed": false,
@ -2888,7 +2954,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"datasource": "prometheus",
"fill": 1,
"gridPos": {
"h": 7,
@ -2929,6 +2995,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Compaction duration",
"tooltip": {
@ -2961,14 +3028,18 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"datasource": "prometheus",
"fill": 1,
"gridPos": {
"h": 7,
@ -3009,6 +3080,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Go Garbage collection duration",
"tooltip": {
@ -3041,14 +3113,18 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"datasource": "prometheus",
"fill": 1,
"gridPos": {
"h": 7,
@ -3089,6 +3165,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "WAL truncate duration seconds",
"tooltip": {
@ -3121,14 +3198,18 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"datasource": "prometheus",
"fill": 1,
"gridPos": {
"h": 7,
@ -3169,6 +3250,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "WAL fsync duration seconds",
"tooltip": {
@ -3201,7 +3283,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"collapsed": false,
@ -3307,6 +3393,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Memory",
"tooltip": {
@ -3340,7 +3427,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
@ -3399,6 +3490,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Allocations per second",
"tooltip": {
@ -3432,7 +3524,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
@ -3488,6 +3584,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "CPU per second",
"tooltip": {
@ -3523,7 +3620,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"collapsed": false,
@ -4895,6 +4996,7 @@
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Net errors",
"tooltip": {
@ -4928,7 +5030,11 @@
"min": null,
"show": true
}
]
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
],
"refresh": "5m",
@ -5009,12 +5115,17 @@
],
"query": "1m,10m,30m,1h,6h,12h,1d,7d,14d,30d",
"refresh": 2,
"skipUrlSync": false,
"type": "interval"
},
{
"allValue": null,
"current": {},
"current": {
"text": "10.32.0.53:9090",
"value": "10.32.0.53:9090"
},
"datasource": "$datasource",
"definition": "",
"hide": 0,
"includeAll": false,
"label": "Instance",
@ -5024,6 +5135,7 @@
"query": "label_values(prometheus_build_info, instance)",
"refresh": 2,
"regex": "",
"skipUrlSync": false,
"sort": 2,
"tagValuesQuery": "",
"tags": [],
@ -5033,19 +5145,20 @@
},
{
"current": {
"value": "${VAR_SCRAPE_INTERVAL}",
"text": "${VAR_SCRAPE_INTERVAL}"
"text": "60",
"value": "60"
},
"hide": 0,
"label": "Scrape interval seconds",
"name": "scrape_interval",
"options": [
{
"value": "${VAR_SCRAPE_INTERVAL}",
"text": "${VAR_SCRAPE_INTERVAL}"
"text": "60",
"value": "60"
}
],
"query": "${VAR_SCRAPE_INTERVAL}",
"query": "60",
"skipUrlSync": false,
"type": "constant"
},
{
@ -5060,6 +5173,7 @@
"query": "prometheus",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"type": "datasource"
},
{
@ -5074,12 +5188,13 @@
"query": "influxdb",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"type": "datasource"
}
]
},
"time": {
"from": "now-7d",
"from": "now-3h",
"to": "now"
},
"timepicker": {
@ -5110,5 +5225,5 @@
"timezone": "browser",
"title": "Prometheus2.0",
"uid": "XmsJC9mRz",
"version": 4
"version": 1
}

View File

@ -1,6 +1,11 @@
local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') +
// (import 'kube-prometheus/kube-prometheus-anti-affinity.libsonnet') +
(import 'kube-prometheus/kube-prometheus-kops-coredns.libsonnet') +
(import 'kube-prometheus/kube-prometheus-kubeadm.libsonnet') +
(import 'image_sources_versions.jsonnet') +
{
_config+:: {
namespace: "monitoring",
@ -12,67 +17,17 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
prom_ingress: 'prometheus.internal.carlosedp.com',
alert_ingress: 'alertmanager.internal.carlosedp.com',
grafana_ingress: 'grafana.internal.carlosedp.com',
},
versions+:: {
prometheus: "v2.5.0",
alertmanager: "v0.15.3",
kubeStateMetrics: "v1.5.0",
kubeRbacProxy: "v0.4.1",
addonResizer: "2.1",
nodeExporter: "v0.17.0",
prometheusOperator: "v0.28.0",
prometheusAdapter: "v0.4.1",
grafana: "v5.4.0",
configmapReloader: "v0.2.2",
prometheusConfigReloader: "v0.28.0",
},
imageRepos+:: {
prometheus: "carlosedp/prometheus",
alertmanager: "carlosedp/alertmanager",
kubeStateMetrics: "carlosedp/kube-state-metrics",
kubeRbacProxy: "carlosedp/kube-rbac-proxy",
addonResizer: "carlosedp/addon-resizer",
nodeExporter: "carlosedp/node_exporter",
prometheusOperator: "carlosedp/prometheus-operator",
prometheusAdapter: "carlosedp/k8s-prometheus-adapter",
grafana: "carlosedp/monitoring-grafana",
configmapReloader: "carlosedp/configmap-reload",
prometheusConfigReloader: "carlosedp/prometheus-config-reloader",
grafana_ingress_external: 'grafana.cloud.carlosedp.com',
},
prometheus+:: {
names: 'k8s',
replicas: 1,
namespaces: ["default", "kube-system","monitoring","logging"],
namespaces: ["default", "kube-system", "monitoring", "logging", "metallb-system"],
},
alertmanager+:: {
name: 'main',
config: |||
global:
resolve_timeout: 5m
route:
group_by: ['job']
group_wait: 30s
group_interval: 5m
repeat_interval: 12h
receiver: 'null'
routes:
- match:
alertname: DeadMansSwitch
receiver: 'null'
receivers:
- name: 'null'
|||,
replicas: 1,
// Configure External URL's
alertmanager+: {
spec+: {
externalUrl: $._config.urls.alert_externalUrl,
},
},
},
kubeStateMetrics+:: {
@ -89,13 +44,13 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
grafana+:: {
config: {
sections: {
database: { path: '/data/grafana.db' },
paths: {
data: '/var/lib/grafana',
logs: '/var/lib/grafana/log',
plugins: '/var/lib/grafana/plugins',
provisioning: '/etc/grafana/provisioning',
},
// database: { path: '/data/grafana.db' },
// paths: {
// data: '/var/lib/grafana',
// logs: '/var/lib/grafana/log',
// plugins: '/var/lib/grafana/plugins',
// provisioning: '/etc/grafana/provisioning',
// },
session: { provider: 'memory' },
'auth.basic': {enabled: false},
'auth.anonymous': {enabled: false},
@ -111,15 +66,13 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
},
},
},
},
//---------------------------------------
// End of _config
//---------------------------------------
},
prometheus+:: {
local pvc = k.core.v1.persistentVolumeClaim,
prometheus+: {
spec+: {
retention: '15d',
@ -128,26 +81,31 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
volumeClaimTemplate:
pvc.new() +
pvc.mixin.spec.withAccessModes('ReadWriteOnce') +
pvc.mixin.spec.resources.withRequests({ storage: '20Gi' }) +
pvc.mixin.spec.withStorageClassName('nfs-ssd-node1'),
pvc.mixin.spec.resources.withRequests({ storage: '20Gi' })
# Uncomment below to define a StorageClass name
#+ pvc.mixin.spec.withStorageClassName('nfs-master-ssd'),
},
},
},
},
# Override command for Grafana to load ini from correct path
# Override command for Grafana persist data
// grafana+:: {
// deployment+:
// {
// local pvc = k.core.v1.persistentVolumeClaim,
// spec+: {
// volumeClaimTemplate:
// pvc.new() +
// pvc.mixin.metadata.withNamespace($._config.namespace) +
// local deployment = k.apps.v1beta2.deployment,
// local container = deployment.mixin.spec.template.spec.containersType,
// local containerVolumeMount = container.volumeMountsType,
// local volume = deployment.mixin.spec.template.spec.volumesType,
// local grafanaStorage = pvc.new() + pvc.mixin.metadata.withNamespace($._config.namespace) +
// pvc.mixin.metadata.withName("grafana-storage") +
// pvc.mixin.spec.withAccessModes('ReadWriteMany') +
// pvc.mixin.spec.resources.withRequests({ storage: '2Gi' }) +
// pvc.mixin.spec.withStorageClassName('nfs-ssd-node1'),
// pvc.mixin.spec.resources.withRequests({ storage: '2Gi' }),
// deployment+: {
// // local storageVolumeName = grafanaStorage,
// // local storageVolume = volume.fromPersistentVolumeClaim(grafanaStorage),
// // },
// // {
// spec+: {
// template+: {
// spec+: {
// containers:
@ -155,43 +113,53 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
// function(c)
// if c.name == 'grafana' then
// c {
// args+: [
// '-config=/etc/grafana/grafana.ini',
// volumeMounts+: [
// containerVolumeMount.new("grafana-storage", "/var/lib/grafana"),
// ],
// }
// else
// c,
// super.containers,
// ),
// volumes+: [
// volume.fromPersistentVolumeClaim(grafanaStorage, "grafana-storage"),
// ],
// },
// },
// },
// },
// },
// Override command for addon-resizer due to change from parameter --threshold to --acceptance-offset
// Add custom dashboards
grafanaDashboards+:: {
'kubernetes-cluster-dashboard.json': (import 'grafana-dashboards/kubernetes-cluster-dashboard.json'),
'prometheus-dashboard.json': (import 'grafana-dashboards/prometheus-dashboard.json'),
'traefik-dashboard.json': (import 'grafana-dashboards/traefik-dashboard.json'),
},
kubeStateMetrics+:: {
// Override command for addon-resizer due to change from parameter --threshold to --acceptance-offset
deployment+: {
spec+: {
template+: {
spec+: {
containers:
std.filterMap(
function(c) c.name == 'addon-resizer',
std.map(
function(c)
if std.startsWith(c.name, 'addon-resizer') then
c {
command: [
'/pod_nanny',
'--container=kube-state-metrics',
'--cpu=' + $._config.kubeStateMetrics.baseCPU,
'--extra-cpu=' + $._config.kubeStateMetrics.cpuPerNode,
'--memory=' + $._config.kubeStateMetrics.baseMemory,
'--extra-memory=' + $._config.kubeStateMetrics.memoryPerNode,
'--cpu=100m',
'--extra-cpu=2m',
'--memory=150Mi',
'--extra-memory=30Mi',
'--acceptance-offset=5',
'--deployment=kube-state-metrics',
],
},
}
else
c,
super.containers,
),
},
@ -212,11 +180,6 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
ingress.new() +
ingress.mixin.metadata.withName('alertmanager-main') +
ingress.mixin.metadata.withNamespace($._config.namespace) +
// ingress.mixin.metadata.withAnnotations({
// 'nginx.ingress.kubernetes.io/auth-type': 'basic',
// 'nginx.ingress.kubernetes.io/auth-secret': 'basic-auth',
// 'nginx.ingress.kubernetes.io/auth-realm': 'Authentication Required',
// }) +
ingress.mixin.spec.withRules(
ingressRule.new() +
ingressRule.withHost($._config.urls.alert_ingress) +
@ -231,11 +194,6 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
ingress.new() +
ingress.mixin.metadata.withName('grafana') +
ingress.mixin.metadata.withNamespace($._config.namespace) +
// ingress.mixin.metadata.withAnnotations({
// 'nginx.ingress.kubernetes.io/auth-type': 'basic',
// 'nginx.ingress.kubernetes.io/auth-secret': 'basic-auth',
// 'nginx.ingress.kubernetes.io/auth-realm': 'Authentication Required',
// }) +
ingress.mixin.spec.withRules(
ingressRule.new() +
ingressRule.withHost($._config.urls.grafana_ingress) +
@ -250,11 +208,6 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
ingress.new() +
ingress.mixin.metadata.withName('prometheus-k8s') +
ingress.mixin.metadata.withNamespace($._config.namespace) +
// ingress.mixin.metadata.withAnnotations({
// 'nginx.ingress.kubernetes.io/auth-type': 'basic',
// 'nginx.ingress.kubernetes.io/auth-secret': 'basic-auth',
// 'nginx.ingress.kubernetes.io/auth-realm': 'Authentication Required',
// }) +
ingress.mixin.spec.withRules(
ingressRule.new() +
ingressRule.withHost($._config.urls.prom_ingress) +
@ -265,17 +218,32 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
httpIngressPath.mixin.backend.withServicePort('web')
),
),
// 'grafana-external':
// // Example external ingress with authentication
// ingress.new() +
// ingress.mixin.metadata.withName('grafana-external') +
// ingress.mixin.metadata.withNamespace($._config.namespace) +
// ingress.mixin.metadata.withLabels({'traffic-type': 'external'}) +
// ingress.mixin.metadata.withAnnotations({
// 'ingress.kubernetes.io/auth-type': 'basic',
// 'ingress.kubernetes.io/auth-secret': 'basic-auth',
// }) +
// ingress.mixin.spec.withRules(
// ingressRule.new() +
// ingressRule.withHost($._config.urls.grafana_ingress_external) +
// ingressRule.mixin.http.withPaths(
// httpIngressPath.new() +
// httpIngressPath.withPath('/') +
// httpIngressPath.mixin.backend.withServiceName('grafana') +
// httpIngressPath.mixin.backend.withServicePort('http')
// ),
// ),
// 'basic-auth-secret':
// // First generate the auth secret with gen_auth.sh script
// secret.new('basic-auth', { auth: std.base64(importstr 'auth') }) +
// secret.mixin.metadata.withNamespace($._config.namespace),
},
};
// + {
// Create basic auth secret - replace 'auth' file with your own
// Create with htpasswd -c auth [USERNAME]
// ingress+:: {
// 'basic-auth-secret':
// secret.new('basic-auth', { auth: std.base64(importstr 'auth') }) +
// secret.mixin.metadata.withNamespace($._config.namespace),
// },
// };
{ ['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) } +