mirror of
https://github.com/carlosedp/cluster-monitoring.git
synced 2024-11-20 19:07:17 +01:00
Formatted files with jsonnet_fmt
This commit is contained in:
parent
408e21d044
commit
362478a928
@ -87,4 +87,4 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
service.mixin.metadata.withLabels({ 'k8s-app': 'arm-exporter' }) +
|
service.mixin.metadata.withLabels({ 'k8s-app': 'arm-exporter' }) +
|
||||||
service.mixin.spec.withClusterIp('None'),
|
service.mixin.spec.withClusterIp('None'),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
||||||
{
|
{
|
||||||
_config+:: {
|
_config+:: {
|
||||||
namespace: "monitoring",
|
namespace: 'monitoring',
|
||||||
|
|
||||||
urls+:: {
|
urls+:: {
|
||||||
prom_ingress: 'prometheus.internal.carlosedp.com',
|
prom_ingress: 'prometheus.internal.carlosedp.com',
|
||||||
@ -13,7 +13,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
prometheus+:: {
|
prometheus+:: {
|
||||||
names: 'k8s',
|
names: 'k8s',
|
||||||
replicas: 1,
|
replicas: 1,
|
||||||
namespaces: ["default", "kube-system", "monitoring", "logging", "metallb-system"],
|
namespaces: ['default', 'kube-system', 'monitoring', 'logging', 'metallb-system'],
|
||||||
},
|
},
|
||||||
|
|
||||||
alertmanager+:: {
|
alertmanager+:: {
|
||||||
@ -31,16 +31,16 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
memoryPerNode: '30Mi',
|
memoryPerNode: '30Mi',
|
||||||
},
|
},
|
||||||
|
|
||||||
// Add custom Grafana dashboards
|
// Add custom Grafana dashboards
|
||||||
grafanaDashboards+:: {
|
grafanaDashboards+:: {
|
||||||
'kubernetes-cluster-dashboard.json': (import 'grafana-dashboards/kubernetes-cluster-dashboard.json'),
|
'kubernetes-cluster-dashboard.json': (import 'grafana-dashboards/kubernetes-cluster-dashboard.json'),
|
||||||
'prometheus-dashboard.json': (import 'grafana-dashboards/prometheus-dashboard.json'),
|
'prometheus-dashboard.json': (import 'grafana-dashboards/prometheus-dashboard.json'),
|
||||||
'coredns-dashboard.json': (import 'grafana-dashboards/coredns-dashboard.json'),
|
'coredns-dashboard.json': (import 'grafana-dashboards/coredns-dashboard.json'),
|
||||||
},
|
},
|
||||||
|
|
||||||
grafana+:: {
|
grafana+:: {
|
||||||
config: {
|
config: {
|
||||||
sections: {
|
sections: {
|
||||||
// database: { path: '/data/grafana.db' },
|
// database: { path: '/data/grafana.db' },
|
||||||
// paths: {
|
// paths: {
|
||||||
// data: '/var/lib/grafana',
|
// data: '/var/lib/grafana',
|
||||||
@ -48,149 +48,151 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
// plugins: '/var/lib/grafana/plugins',
|
// plugins: '/var/lib/grafana/plugins',
|
||||||
// provisioning: '/etc/grafana/provisioning',
|
// provisioning: '/etc/grafana/provisioning',
|
||||||
// },
|
// },
|
||||||
session: { provider: 'memory' },
|
session: { provider: 'memory' },
|
||||||
'auth.basic': {enabled: false},
|
'auth.basic': { enabled: false },
|
||||||
'auth.anonymous': {enabled: false},
|
'auth.anonymous': { enabled: false },
|
||||||
smtp: {
|
smtp: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
host: 'smtp-server.monitoring.svc:25',
|
host: 'smtp-server.monitoring.svc:25',
|
||||||
user: '',
|
user: '',
|
||||||
password: '',
|
password: '',
|
||||||
from_address:'carlosedp@gmail.com',
|
from_address: 'carlosedp@gmail.com',
|
||||||
from_name: 'Grafana Alert',
|
from_name: 'Grafana Alert',
|
||||||
skip_verify: true
|
skip_verify: true,
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
//---------------------------------------
|
},
|
||||||
// End of _config
|
//---------------------------------------
|
||||||
//---------------------------------------
|
// End of _config
|
||||||
|
//---------------------------------------
|
||||||
|
|
||||||
prometheus+:: {
|
prometheus+:: {
|
||||||
local pvc = k.core.v1.persistentVolumeClaim,
|
local pvc = k.core.v1.persistentVolumeClaim,
|
||||||
prometheus+: {
|
prometheus+: {
|
||||||
spec+: {
|
spec+: {
|
||||||
retention: '15d',
|
retention: '15d',
|
||||||
externalUrl: 'http://' + $._config.urls.prom_ingress,
|
externalUrl: 'http://' + $._config.urls.prom_ingress,
|
||||||
storage: {
|
storage: {
|
||||||
volumeClaimTemplate:
|
volumeClaimTemplate:
|
||||||
pvc.new() +
|
pvc.new() +
|
||||||
pvc.mixin.spec.withAccessModes('ReadWriteOnce') +
|
pvc.mixin.spec.withAccessModes('ReadWriteOnce') +
|
||||||
pvc.mixin.spec.resources.withRequests({ storage: '20Gi' })
|
pvc.mixin.spec.resources.withRequests({ storage: '20Gi' }),
|
||||||
# Uncomment below to define a StorageClass name
|
// Uncomment below to define a StorageClass name
|
||||||
#+ pvc.mixin.spec.withStorageClassName('nfs-master-ssd'),
|
//+ pvc.mixin.spec.withStorageClassName('nfs-master-ssd'),
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
|
||||||
# Override deployment for Grafana data persistence
|
// Override deployment for Grafana data persistence
|
||||||
grafana+:: {
|
grafana+:: {
|
||||||
deployment+: {
|
deployment+: {
|
||||||
spec+: {
|
spec+: {
|
||||||
template+: {
|
template+: {
|
||||||
spec+: {
|
spec+: {
|
||||||
volumes:
|
volumes:
|
||||||
std.map(
|
std.map(
|
||||||
function(v)
|
function(v)
|
||||||
if v.name == 'grafana-storage' then
|
if v.name == 'grafana-storage' then
|
||||||
{'name':'grafana-storage',
|
{
|
||||||
'persistentVolumeClaim': {
|
name: 'grafana-storage',
|
||||||
'claimName': 'grafana-storage'}
|
persistentVolumeClaim: {
|
||||||
|
claimName: 'grafana-storage',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
else v,
|
else v,
|
||||||
super.volumes
|
super.volumes
|
||||||
),
|
),
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
storage:
|
|
||||||
local pvc = k.core.v1.persistentVolumeClaim;
|
|
||||||
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' }),
|
|
||||||
},
|
},
|
||||||
|
storage:
|
||||||
|
local pvc = k.core.v1.persistentVolumeClaim;
|
||||||
|
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' }),
|
||||||
|
},
|
||||||
|
|
||||||
grafanaDashboards+:: $._config.grafanaDashboards,
|
grafanaDashboards+:: $._config.grafanaDashboards,
|
||||||
|
|
||||||
// Create ingress objects per application
|
// Create ingress objects per application
|
||||||
ingress+: {
|
ingress+: {
|
||||||
local secret = k.core.v1.secret,
|
local secret = k.core.v1.secret,
|
||||||
local ingress = k.extensions.v1beta1.ingress,
|
local ingress = k.extensions.v1beta1.ingress,
|
||||||
local ingressTls = ingress.mixin.spec.tlsType,
|
local ingressTls = ingress.mixin.spec.tlsType,
|
||||||
local ingressRule = ingress.mixin.spec.rulesType,
|
local ingressRule = ingress.mixin.spec.rulesType,
|
||||||
local httpIngressPath = ingressRule.mixin.http.pathsType,
|
local httpIngressPath = ingressRule.mixin.http.pathsType,
|
||||||
|
|
||||||
'alertmanager-main':
|
'alertmanager-main':
|
||||||
ingress.new() +
|
ingress.new() +
|
||||||
ingress.mixin.metadata.withName('alertmanager-main') +
|
ingress.mixin.metadata.withName('alertmanager-main') +
|
||||||
ingress.mixin.metadata.withNamespace($._config.namespace) +
|
ingress.mixin.metadata.withNamespace($._config.namespace) +
|
||||||
ingress.mixin.spec.withRules(
|
ingress.mixin.spec.withRules(
|
||||||
ingressRule.new() +
|
ingressRule.new() +
|
||||||
ingressRule.withHost($._config.urls.alert_ingress) +
|
ingressRule.withHost($._config.urls.alert_ingress) +
|
||||||
ingressRule.mixin.http.withPaths(
|
ingressRule.mixin.http.withPaths(
|
||||||
httpIngressPath.new() +
|
httpIngressPath.new() +
|
||||||
httpIngressPath.withPath('/') +
|
httpIngressPath.withPath('/') +
|
||||||
httpIngressPath.mixin.backend.withServiceName('alertmanager-main') +
|
httpIngressPath.mixin.backend.withServiceName('alertmanager-main') +
|
||||||
httpIngressPath.mixin.backend.withServicePort('web')
|
httpIngressPath.mixin.backend.withServicePort('web')
|
||||||
),
|
|
||||||
),
|
),
|
||||||
'grafana':
|
),
|
||||||
ingress.new() +
|
grafana:
|
||||||
ingress.mixin.metadata.withName('grafana') +
|
ingress.new() +
|
||||||
ingress.mixin.metadata.withNamespace($._config.namespace) +
|
ingress.mixin.metadata.withName('grafana') +
|
||||||
ingress.mixin.spec.withRules(
|
ingress.mixin.metadata.withNamespace($._config.namespace) +
|
||||||
ingressRule.new() +
|
ingress.mixin.spec.withRules(
|
||||||
ingressRule.withHost($._config.urls.grafana_ingress) +
|
ingressRule.new() +
|
||||||
ingressRule.mixin.http.withPaths(
|
ingressRule.withHost($._config.urls.grafana_ingress) +
|
||||||
httpIngressPath.new() +
|
ingressRule.mixin.http.withPaths(
|
||||||
httpIngressPath.withPath('/') +
|
httpIngressPath.new() +
|
||||||
httpIngressPath.mixin.backend.withServiceName('grafana') +
|
httpIngressPath.withPath('/') +
|
||||||
httpIngressPath.mixin.backend.withServicePort('http')
|
httpIngressPath.mixin.backend.withServiceName('grafana') +
|
||||||
),
|
httpIngressPath.mixin.backend.withServicePort('http')
|
||||||
),
|
),
|
||||||
'prometheus-k8s':
|
),
|
||||||
ingress.new() +
|
'prometheus-k8s':
|
||||||
ingress.mixin.metadata.withName('prometheus-k8s') +
|
ingress.new() +
|
||||||
ingress.mixin.metadata.withNamespace($._config.namespace) +
|
ingress.mixin.metadata.withName('prometheus-k8s') +
|
||||||
ingress.mixin.spec.withRules(
|
ingress.mixin.metadata.withNamespace($._config.namespace) +
|
||||||
ingressRule.new() +
|
ingress.mixin.spec.withRules(
|
||||||
ingressRule.withHost($._config.urls.prom_ingress) +
|
ingressRule.new() +
|
||||||
ingressRule.mixin.http.withPaths(
|
ingressRule.withHost($._config.urls.prom_ingress) +
|
||||||
httpIngressPath.new() +
|
ingressRule.mixin.http.withPaths(
|
||||||
httpIngressPath.withPath('/') +
|
httpIngressPath.new() +
|
||||||
httpIngressPath.mixin.backend.withServiceName('prometheus-k8s') +
|
httpIngressPath.withPath('/') +
|
||||||
httpIngressPath.mixin.backend.withServicePort('web')
|
httpIngressPath.mixin.backend.withServiceName('prometheus-k8s') +
|
||||||
),
|
httpIngressPath.mixin.backend.withServicePort('web')
|
||||||
),
|
),
|
||||||
// // Example external ingress with authentication
|
),
|
||||||
// 'grafana-external':
|
// // Example external ingress with authentication
|
||||||
// ingress.new() +
|
// 'grafana-external':
|
||||||
// ingress.mixin.metadata.withName('grafana-external') +
|
// ingress.new() +
|
||||||
// ingress.mixin.metadata.withNamespace($._config.namespace) +
|
// ingress.mixin.metadata.withName('grafana-external') +
|
||||||
// ingress.mixin.metadata.withLabels({'traffic-type': 'external'}) +
|
// ingress.mixin.metadata.withNamespace($._config.namespace) +
|
||||||
// ingress.mixin.metadata.withAnnotations({
|
// ingress.mixin.metadata.withLabels({'traffic-type': 'external'}) +
|
||||||
// 'ingress.kubernetes.io/auth-type': 'basic',
|
// ingress.mixin.metadata.withAnnotations({
|
||||||
// 'ingress.kubernetes.io/auth-secret': 'basic-auth',
|
// 'ingress.kubernetes.io/auth-type': 'basic',
|
||||||
// }) +
|
// 'ingress.kubernetes.io/auth-secret': 'basic-auth',
|
||||||
// ingress.mixin.spec.withRules(
|
// }) +
|
||||||
// ingressRule.new() +
|
// ingress.mixin.spec.withRules(
|
||||||
// ingressRule.withHost($._config.urls.grafana_ingress_external) +
|
// ingressRule.new() +
|
||||||
// ingressRule.mixin.http.withPaths(
|
// ingressRule.withHost($._config.urls.grafana_ingress_external) +
|
||||||
// httpIngressPath.new() +
|
// ingressRule.mixin.http.withPaths(
|
||||||
// httpIngressPath.withPath('/') +
|
// httpIngressPath.new() +
|
||||||
// httpIngressPath.mixin.backend.withServiceName('grafana') +
|
// httpIngressPath.withPath('/') +
|
||||||
// httpIngressPath.mixin.backend.withServicePort('http')
|
// httpIngressPath.mixin.backend.withServiceName('grafana') +
|
||||||
// ),
|
// httpIngressPath.mixin.backend.withServicePort('http')
|
||||||
// ),
|
// ),
|
||||||
// 'basic-auth-secret':
|
// ),
|
||||||
// // First generate the auth secret with gen_auth.sh script
|
// 'basic-auth-secret':
|
||||||
// secret.new('basic-auth', { auth: std.base64(importstr 'auth') }) +
|
// // First generate the auth secret with gen_auth.sh script
|
||||||
// secret.mixin.metadata.withNamespace($._config.namespace),
|
// secret.new('basic-auth', { auth: std.base64(importstr 'auth') }) +
|
||||||
},
|
// secret.mixin.metadata.withNamespace($._config.namespace),
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
@ -21,18 +21,20 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
local podLabels = { 'k8s-app': 'elasticsearch-exporter' };
|
local podLabels = { 'k8s-app': 'elasticsearch-exporter' };
|
||||||
local elasticExporter =
|
local elasticExporter =
|
||||||
container.new('elasticsearch-exporter',
|
container.new('elasticsearch-exporter',
|
||||||
$._config.imageRepos.elasticExporter + ':' + $._config.versions.elasticExporter) +
|
$._config.imageRepos.elasticExporter + ':' + $._config.versions.elasticExporter) +
|
||||||
container.withCommand(['/bin/elasticsearch_exporter',
|
container.withCommand([
|
||||||
'-es.uri=http://elasticsearch.logging.svc:9200',
|
'/bin/elasticsearch_exporter',
|
||||||
'-es.timeout=60s',
|
'-es.uri=http://elasticsearch.logging.svc:9200',
|
||||||
'-es.all=true']) +
|
'-es.timeout=60s',
|
||||||
|
'-es.all=true',
|
||||||
|
]) +
|
||||||
container.withPorts(containerPort.newNamed('es-metrics', 9108)) +
|
container.withPorts(containerPort.newNamed('es-metrics', 9108)) +
|
||||||
container.mixin.securityContext.capabilities.withDrop(['SETPCAP' , 'MKNOD' , 'AUDIT_WRITE' , 'CHOWN' , 'NET_RAW' , 'DAC_OVERRIDE' , 'FOWNER' , 'FSETID' , 'KILL' , 'SETGID' , 'SETUID' , 'NET_BIND_SERVICE' , 'SYS_CHROOT' , 'SETFCAP']) +
|
container.mixin.securityContext.capabilities.withDrop(['SETPCAP', 'MKNOD', 'AUDIT_WRITE', 'CHOWN', 'NET_RAW', 'DAC_OVERRIDE', 'FOWNER', 'FSETID', 'KILL', 'SETGID', 'SETUID', 'NET_BIND_SERVICE', 'SYS_CHROOT', 'SETFCAP']) +
|
||||||
container.mixin.securityContext.withRunAsNonRoot(true) +
|
container.mixin.securityContext.withRunAsNonRoot(true) +
|
||||||
container.mixin.securityContext.withRunAsUser(1000) +
|
container.mixin.securityContext.withRunAsUser(1000) +
|
||||||
container.mixin.securityContext.withReadOnlyRootFilesystem(true) +
|
container.mixin.securityContext.withReadOnlyRootFilesystem(true) +
|
||||||
container.mixin.resources.withRequests({memory: "64Mi", cpu: "25m"}) +
|
container.mixin.resources.withRequests({ memory: '64Mi', cpu: '25m' }) +
|
||||||
container.mixin.resources.withLimits({memory: "128Mi", cpu: "100m"}) +
|
container.mixin.resources.withLimits({ memory: '128Mi', cpu: '100m' }) +
|
||||||
container.mixin.livenessProbe.httpGet.withPath('/health') +
|
container.mixin.livenessProbe.httpGet.withPath('/health') +
|
||||||
container.mixin.livenessProbe.httpGet.withPort(9108) +
|
container.mixin.livenessProbe.httpGet.withPort(9108) +
|
||||||
container.mixin.livenessProbe.withInitialDelaySeconds(30) +
|
container.mixin.livenessProbe.withInitialDelaySeconds(30) +
|
||||||
@ -43,16 +45,16 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
container.mixin.readinessProbe.withInitialDelaySeconds(30) +
|
container.mixin.readinessProbe.withInitialDelaySeconds(30) +
|
||||||
container.mixin.readinessProbe.withTimeoutSeconds(10);
|
container.mixin.readinessProbe.withTimeoutSeconds(10);
|
||||||
|
|
||||||
local c = [elasticExporter];
|
local c = [elasticExporter];
|
||||||
|
|
||||||
deployment.new('elasticsearch-exporter', $._config.replicas, c, podLabels) +
|
deployment.new('elasticsearch-exporter', $._config.replicas, c, podLabels) +
|
||||||
deployment.mixin.metadata.withNamespace($._config.namespace) +
|
deployment.mixin.metadata.withNamespace($._config.namespace) +
|
||||||
deployment.mixin.metadata.withLabels(podLabels) +
|
deployment.mixin.metadata.withLabels(podLabels) +
|
||||||
deployment.mixin.spec.selector.withMatchLabels(podLabels) +
|
deployment.mixin.spec.selector.withMatchLabels(podLabels) +
|
||||||
deployment.mixin.spec.strategy.withType('RollingUpdate') +
|
deployment.mixin.spec.strategy.withType('RollingUpdate') +
|
||||||
deployment.mixin.spec.strategy.rollingUpdate.withMaxSurge(1) +
|
deployment.mixin.spec.strategy.rollingUpdate.withMaxSurge(1) +
|
||||||
deployment.mixin.spec.strategy.rollingUpdate.withMaxUnavailable(0) +
|
deployment.mixin.spec.strategy.rollingUpdate.withMaxUnavailable(0) +
|
||||||
deployment.mixin.spec.template.spec.withRestartPolicy('Always'),
|
deployment.mixin.spec.template.spec.withRestartPolicy('Always'),
|
||||||
|
|
||||||
service:
|
service:
|
||||||
local service = k.core.v1.service;
|
local service = k.core.v1.service;
|
||||||
@ -64,68 +66,68 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
service.mixin.metadata.withLabels({ 'k8s-app': 'elasticsearch-exporter' }),
|
service.mixin.metadata.withLabels({ 'k8s-app': 'elasticsearch-exporter' }),
|
||||||
|
|
||||||
serviceMonitorElastic:
|
serviceMonitorElastic:
|
||||||
{
|
{
|
||||||
apiVersion: 'monitoring.coreos.com/v1',
|
apiVersion: 'monitoring.coreos.com/v1',
|
||||||
kind: 'ServiceMonitor',
|
kind: 'ServiceMonitor',
|
||||||
metadata: {
|
metadata: {
|
||||||
name: 'elasticsearch-exporter',
|
name: 'elasticsearch-exporter',
|
||||||
namespace: $._config.namespace,
|
namespace: $._config.namespace,
|
||||||
labels: {
|
labels: {
|
||||||
'k8s-app': 'elasticsearch-exporter',
|
'k8s-app': 'elasticsearch-exporter',
|
||||||
},
|
|
||||||
},
|
|
||||||
spec: {
|
|
||||||
jobLabel: 'k8s-app',
|
|
||||||
selector: {
|
|
||||||
matchLabels: {
|
|
||||||
'k8s-app': 'elasticsearch-exporter',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
endpoints: [
|
spec: {
|
||||||
{
|
jobLabel: 'k8s-app',
|
||||||
port: 'es-metrics',
|
selector: {
|
||||||
scheme: 'http',
|
matchLabels: {
|
||||||
interval: '30s',
|
'k8s-app': 'elasticsearch-exporter',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
endpoints: [
|
||||||
|
{
|
||||||
|
port: 'es-metrics',
|
||||||
|
scheme: 'http',
|
||||||
|
interval: '30s',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
namespaceSelector: {
|
||||||
|
matchNames: [
|
||||||
|
'monitoring',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
|
||||||
namespaceSelector: {
|
|
||||||
matchNames: [
|
|
||||||
'monitoring',
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
serviceMonitorFluentd:
|
serviceMonitorFluentd:
|
||||||
{
|
{
|
||||||
apiVersion: 'monitoring.coreos.com/v1',
|
apiVersion: 'monitoring.coreos.com/v1',
|
||||||
kind: 'ServiceMonitor',
|
kind: 'ServiceMonitor',
|
||||||
metadata: {
|
metadata: {
|
||||||
name: 'fluentd-es',
|
name: 'fluentd-es',
|
||||||
namespace: $._config.namespace,
|
namespace: $._config.namespace,
|
||||||
labels: {
|
labels: {
|
||||||
'k8s-app': 'fluentd-es',
|
'k8s-app': 'fluentd-es',
|
||||||
},
|
|
||||||
},
|
|
||||||
spec: {
|
|
||||||
jobLabel: 'k8s-app',
|
|
||||||
selector: {
|
|
||||||
matchLabels: {
|
|
||||||
'k8s-app': 'fluentd-es',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
endpoints: [
|
spec: {
|
||||||
{
|
jobLabel: 'k8s-app',
|
||||||
port: 'metrics',
|
selector: {
|
||||||
scheme: 'http',
|
matchLabels: {
|
||||||
interval: '30s',
|
'k8s-app': 'fluentd-es',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
endpoints: [
|
||||||
namespaceSelector: {
|
{
|
||||||
matchNames: [
|
port: 'metrics',
|
||||||
|
scheme: 'http',
|
||||||
|
interval: '30s',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
namespaceSelector: {
|
||||||
|
matchNames: [
|
||||||
'logging',
|
'logging',
|
||||||
]
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
},
|
},
|
||||||
} + (import 'elasticsearch_rules.jsonnet')
|
} + (import 'elasticsearch_rules.jsonnet')
|
||||||
|
@ -1,37 +1,37 @@
|
|||||||
{
|
{
|
||||||
_config+:: {
|
_config+:: {
|
||||||
versions+:: {
|
versions+:: {
|
||||||
prometheus: "v2.7.0",
|
prometheus: 'v2.7.0',
|
||||||
alertmanager: "v0.16.0",
|
alertmanager: 'v0.16.0',
|
||||||
kubeStateMetrics: "v1.5.0",
|
kubeStateMetrics: 'v1.5.0',
|
||||||
kubeRbacProxy: "v0.4.1",
|
kubeRbacProxy: 'v0.4.1',
|
||||||
addonResizer: "2.1",
|
addonResizer: '2.1',
|
||||||
nodeExporter: "v0.17.0",
|
nodeExporter: 'v0.17.0',
|
||||||
prometheusOperator: "v0.28.0",
|
prometheusOperator: 'v0.28.0',
|
||||||
prometheusAdapter: "v0.4.1",
|
prometheusAdapter: 'v0.4.1',
|
||||||
grafana: "5.4.3",
|
grafana: '5.4.3',
|
||||||
configmapReloader: "v0.2.2",
|
configmapReloader: 'v0.2.2',
|
||||||
prometheusConfigReloader: "v0.28.0",
|
prometheusConfigReloader: 'v0.28.0',
|
||||||
armExporter: 'latest',
|
armExporter: 'latest',
|
||||||
smtpServer: 'v1.0.1',
|
smtpServer: 'v1.0.1',
|
||||||
elasticExporter: '1.0.4rc1'
|
elasticExporter: '1.0.4rc1',
|
||||||
},
|
},
|
||||||
|
|
||||||
imageRepos+:: {
|
imageRepos+:: {
|
||||||
prometheus: "carlosedp/prometheus",
|
prometheus: 'carlosedp/prometheus',
|
||||||
alertmanager: "carlosedp/alertmanager",
|
alertmanager: 'carlosedp/alertmanager',
|
||||||
kubeStateMetrics: "carlosedp/kube-state-metrics",
|
kubeStateMetrics: 'carlosedp/kube-state-metrics',
|
||||||
kubeRbacProxy: "carlosedp/kube-rbac-proxy",
|
kubeRbacProxy: 'carlosedp/kube-rbac-proxy',
|
||||||
addonResizer: "carlosedp/addon-resizer",
|
addonResizer: 'carlosedp/addon-resizer',
|
||||||
nodeExporter: "carlosedp/node_exporter",
|
nodeExporter: 'carlosedp/node_exporter',
|
||||||
prometheusOperator: "carlosedp/prometheus-operator",
|
prometheusOperator: 'carlosedp/prometheus-operator',
|
||||||
prometheusAdapter: "carlosedp/k8s-prometheus-adapter",
|
prometheusAdapter: 'carlosedp/k8s-prometheus-adapter',
|
||||||
grafana: "grafana/grafana",
|
grafana: 'grafana/grafana',
|
||||||
configmapReloader: "carlosedp/configmap-reload",
|
configmapReloader: 'carlosedp/configmap-reload',
|
||||||
prometheusConfigReloader: "carlosedp/prometheus-config-reloader",
|
prometheusConfigReloader: 'carlosedp/prometheus-config-reloader',
|
||||||
armExporter: 'carlosedp/arm_exporter',
|
armExporter: 'carlosedp/arm_exporter',
|
||||||
smtpServer: 'carlosedp/docker-smtp',
|
smtpServer: 'carlosedp/docker-smtp',
|
||||||
elasticExporter: 'carlosedp/elasticsearch-exporter'
|
elasticExporter: 'carlosedp/elasticsearch-exporter',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
53
main.jsonnet
53
main.jsonnet
@ -1,26 +1,27 @@
|
|||||||
local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
||||||
|
|
||||||
// Enable or disable additional modules
|
// Enable or disable additional modules
|
||||||
local installModules = { 'arm-exporter': true,
|
local installModules = {
|
||||||
'metallb': true,
|
'arm-exporter': true,
|
||||||
'traefik': true,
|
metallb: true,
|
||||||
'ups-exporter': true,
|
traefik: true,
|
||||||
'elastic-exporter': true,
|
'ups-exporter': true,
|
||||||
};
|
'elastic-exporter': true,
|
||||||
|
};
|
||||||
|
|
||||||
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-anti-affinity.libsonnet')
|
||||||
+ (import 'kube-prometheus/kube-prometheus-kops-coredns.libsonnet')
|
+ (import 'kube-prometheus/kube-prometheus-kops-coredns.libsonnet')
|
||||||
+ (import 'kube-prometheus/kube-prometheus-kubeadm.libsonnet')
|
+ (import 'kube-prometheus/kube-prometheus-kubeadm.libsonnet')
|
||||||
+ (import 'image_sources_versions.jsonnet')
|
+ (import 'image_sources_versions.jsonnet')
|
||||||
+ (import 'base_operator_stack.jsonnet')
|
+ (import 'base_operator_stack.jsonnet')
|
||||||
+ (import 'smtp_server.jsonnet')
|
+ (import 'smtp_server.jsonnet')
|
||||||
// Additional Modules
|
// Additional Modules
|
||||||
+ (if installModules['arm-exporter'] then (import 'arm_exporter.jsonnet') else {})
|
+ (if installModules['arm-exporter'] then (import 'arm_exporter.jsonnet') else {})
|
||||||
+ (if installModules['metallb'] then (import 'metallb.jsonnet') else {})
|
+ (if installModules.metallb then (import 'metallb.jsonnet') else {})
|
||||||
+ (if installModules['traefik'] then (import 'traefik.jsonnet') else {})
|
+ (if installModules.traefik then (import 'traefik.jsonnet') else {})
|
||||||
+ (if installModules['ups-exporter'] then (import 'ups_exporter.jsonnet') else {})
|
+ (if installModules['ups-exporter'] then (import 'ups_exporter.jsonnet') else {})
|
||||||
+ (if installModules['elastic-exporter'] then (import 'elasticsearch_exporter.jsonnet') else {});
|
+ (if installModules['elastic-exporter'] then (import 'elasticsearch_exporter.jsonnet') else {});
|
||||||
|
|
||||||
{ ['00namespace-' + name]: kp.kubePrometheus[name] for name in std.objectFields(kp.kubePrometheus) }
|
{ ['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) } +
|
{ ['0prometheus-operator-' + name]: kp.prometheusOperator[name] for name in std.objectFields(kp.prometheusOperator) } +
|
||||||
@ -34,12 +35,12 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet')
|
|||||||
{ ['smtp-server-' + name]: kp.smtpServer[name] for name in std.objectFields(kp.smtpServer) } +
|
{ ['smtp-server-' + name]: kp.smtpServer[name] for name in std.objectFields(kp.smtpServer) } +
|
||||||
// Additional Modules
|
// Additional Modules
|
||||||
(if installModules['arm-exporter'] then
|
(if installModules['arm-exporter'] then
|
||||||
{ ['arm-exporter-' + name]: kp.armExporter[name] for name in std.objectFields(kp.armExporter) } else {}) +
|
{ ['arm-exporter-' + name]: kp.armExporter[name] for name in std.objectFields(kp.armExporter) } else {}) +
|
||||||
(if installModules['metallb'] then
|
(if installModules.metallb then
|
||||||
{ ['metallb-' + name]: kp.metallb[name] for name in std.objectFields(kp.metallb) } else {}) +
|
{ ['metallb-' + name]: kp.metallb[name] for name in std.objectFields(kp.metallb) } else {}) +
|
||||||
(if installModules['traefik'] then
|
(if installModules.traefik then
|
||||||
{ ['traefik-' + name]: kp.traefik[name] for name in std.objectFields(kp.traefik) } else {}) +
|
{ ['traefik-' + name]: kp.traefik[name] for name in std.objectFields(kp.traefik) } else {}) +
|
||||||
(if installModules['ups-exporter'] then
|
(if installModules['ups-exporter'] then
|
||||||
{ ['ups-exporter-' + name]: kp.upsExporter[name] for name in std.objectFields(kp.upsExporter) } else {}) +
|
{ ['ups-exporter-' + name]: kp.upsExporter[name] for name in std.objectFields(kp.upsExporter) } else {}) +
|
||||||
(if installModules['elastic-exporter'] then
|
(if installModules['elastic-exporter'] then
|
||||||
{ ['elasticexporter-' + name]: kp.elasticExporter[name] for name in std.objectFields(kp.elasticExporter)} else {})
|
{ ['elasticexporter-' + name]: kp.elasticExporter[name] for name in std.objectFields(kp.elasticExporter) } else {})
|
||||||
|
@ -32,10 +32,10 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
namespaceSelector: {
|
namespaceSelector: {
|
||||||
matchNames: [
|
matchNames: [
|
||||||
'metallb-system',
|
'metallb-system',
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -45,9 +45,9 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
local servicePort = k.core.v1.service.mixin.spec.portsType;
|
local servicePort = k.core.v1.service.mixin.spec.portsType;
|
||||||
local metallbPort = servicePort.newNamed('http', 7472, 7472);
|
local metallbPort = servicePort.newNamed('http', 7472, 7472);
|
||||||
|
|
||||||
service.new('metallb-controller', {"app": "metallb", "component": "controller"}, metallbPort) +
|
service.new('metallb-controller', { app: 'metallb', component: 'controller' }, metallbPort) +
|
||||||
service.mixin.metadata.withNamespace('metallb-system') +
|
service.mixin.metadata.withNamespace('metallb-system') +
|
||||||
service.mixin.metadata.withLabels({ 'k8s-app': 'metallb-controller' }) +
|
service.mixin.metadata.withLabels({ 'k8s-app': 'metallb-controller' }) +
|
||||||
service.mixin.spec.withClusterIp('None'),
|
service.mixin.spec.withClusterIp('None'),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -29,25 +29,27 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
secretKeyRef: { name: 'smtp-account', key: 'password' },
|
secretKeyRef: { name: 'smtp-account', key: 'password' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{name: 'DISABLE_IPV6',
|
{
|
||||||
value: 'True'},
|
name: 'DISABLE_IPV6',
|
||||||
{name: 'RELAY_DOMAINS', value: ':192.168.0.0/24:10.0.0.0/16'},
|
value: 'True',
|
||||||
|
},
|
||||||
|
{ name: 'RELAY_DOMAINS', value: ':192.168.0.0/24:10.0.0.0/16' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
local c = [smtpServer];
|
local c = [smtpServer];
|
||||||
|
|
||||||
deployment.new('smtp-server', 1, c, podLabels) +
|
deployment.new('smtp-server', 1, c, podLabels) +
|
||||||
deployment.mixin.metadata.withNamespace($._config.namespace) +
|
deployment.mixin.metadata.withNamespace($._config.namespace) +
|
||||||
deployment.mixin.metadata.withLabels(podLabels) +
|
deployment.mixin.metadata.withLabels(podLabels) +
|
||||||
deployment.mixin.spec.selector.withMatchLabels(podLabels),
|
deployment.mixin.spec.selector.withMatchLabels(podLabels),
|
||||||
|
|
||||||
service:
|
service:
|
||||||
local service = k.core.v1.service;
|
local service = k.core.v1.service;
|
||||||
local servicePort = k.core.v1.service.mixin.spec.portsType;
|
local servicePort = k.core.v1.service.mixin.spec.portsType;
|
||||||
local smtpServerPorts = servicePort.newNamed('smtp', 25, 'smtp');
|
local smtpServerPorts = servicePort.newNamed('smtp', 25, 'smtp');
|
||||||
|
|
||||||
service.new('smtp-server', $.smtpServer.deployment.spec.selector.matchLabels, smtpServerPorts) +
|
service.new('smtp-server', $.smtpServer.deployment.spec.selector.matchLabels, smtpServerPorts) +
|
||||||
service.mixin.metadata.withNamespace($._config.namespace) +
|
service.mixin.metadata.withNamespace($._config.namespace) +
|
||||||
service.mixin.metadata.withLabels({ 'run': 'smtp-server' })
|
service.mixin.metadata.withLabels({ run: 'smtp-server' }),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
namespace: 'monitoring',
|
namespace: 'monitoring',
|
||||||
// Add custom dashboards
|
// Add custom dashboards
|
||||||
grafanaDashboards+:: {
|
grafanaDashboards+:: {
|
||||||
'traefik-dashboard.json': (import 'grafana-dashboards/traefik-dashboard.json'),
|
'traefik-dashboard.json': (import 'grafana-dashboards/traefik-dashboard.json'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -38,9 +38,9 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
namespaceSelector: {
|
namespaceSelector: {
|
||||||
matchNames: [
|
matchNames: [
|
||||||
'kube-system',
|
'kube-system',
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,8 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
upsExporter+:: {
|
upsExporter+:: {
|
||||||
serviceMonitor:
|
serviceMonitor:
|
||||||
{
|
{
|
||||||
apiVersion: 'monitoring.coreos.com/v1',
|
apiVersion: 'monitoring.coreos.com/v1',
|
||||||
kind: 'ServiceMonitor',
|
kind: 'ServiceMonitor',
|
||||||
@ -30,14 +30,14 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
jobLabel: 'k8s-app',
|
jobLabel: 'k8s-app',
|
||||||
selector: {
|
selector: {
|
||||||
matchLabels: {
|
matchLabels: {
|
||||||
'k8s-app': 'ups-exporter',
|
'k8s-app': 'ups-exporter',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
endpoints: [
|
endpoints: [
|
||||||
{
|
{
|
||||||
port: 'metrics',
|
port: 'metrics',
|
||||||
scheme: 'http',
|
scheme: 'http',
|
||||||
interval: '30s',
|
interval: '30s',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -65,11 +65,11 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
endpointPort.withProtocol('TCP');
|
endpointPort.withProtocol('TCP');
|
||||||
|
|
||||||
local subset = endpointSubset.new() +
|
local subset = endpointSubset.new() +
|
||||||
endpointSubset.withAddresses([
|
endpointSubset.withAddresses([
|
||||||
{ ip: IP }
|
{ ip: IP }
|
||||||
for IP in $._config.ups.ips
|
for IP in $._config.ups.ips
|
||||||
]) +
|
]) +
|
||||||
endpointSubset.withPorts(upsPort);
|
endpointSubset.withPorts(upsPort);
|
||||||
|
|
||||||
endpoints.new() +
|
endpoints.new() +
|
||||||
endpoints.mixin.metadata.withName('ups-exporter') +
|
endpoints.mixin.metadata.withName('ups-exporter') +
|
||||||
@ -77,4 +77,4 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
endpoints.mixin.metadata.withLabels({ 'k8s-app': 'ups-exporter' }) +
|
endpoints.mixin.metadata.withLabels({ 'k8s-app': 'ups-exporter' }) +
|
||||||
endpoints.withSubsets(subset),
|
endpoints.withSubsets(subset),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user