Added Traefik. Updated image versions

This commit is contained in:
CarlosEDP 2019-02-01 11:43:22 -02:00
parent 3dabb24eb1
commit 53b31ec856
10 changed files with 114 additions and 65 deletions

View File

@ -25,9 +25,8 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
local armExporter =
container.new('arm-exporter', $._config.imageRepos.armExporter + ':' + $._config.versions.armExporter) +
container.mixin.resources.withRequests({ cpu: '100m', memory: '180Mi' }) +
container.mixin.resources.withLimits({ cpu: '200m', memory: '180Mi' });
container.mixin.resources.withRequests({ cpu: '50m', memory: '50Mi' }) +
container.mixin.resources.withLimits({ cpu: '100m', memory: '100Mi' });
local proxy =
container.new('kube-rbac-proxy', $._config.imageRepos.kubeRbacProxy + ':' + $._config.versions.kubeRbacProxy) +
container.withArgs([

View File

@ -1,2 +1,3 @@
(import 'operator_stack.jsonnet') +
(import 'arm_exporter.jsonnet')
(import 'arm_exporter.jsonnet') +
(import 'traefik.jsonnet')

View File

@ -20,8 +20,8 @@ spec:
- --kubelet-service=kube-system/kubelet
- --logtostderr=true
- --config-reloader-image=carlosedp/configmap-reload:v0.2.2
- --prometheus-config-reloader=carlosedp/prometheus-config-reloader:v0.26.0
image: carlosedp/prometheus-operator:v0.26.0
- --prometheus-config-reloader=carlosedp/prometheus-config-reloader:v0.28.0
image: carlosedp/prometheus-operator:v0.28.0
name: prometheus-operator
ports:
- containerPort: 8080

View File

@ -19,11 +19,11 @@ spec:
name: arm-exporter
resources:
limits:
cpu: 200m
memory: 180Mi
requests:
cpu: 100m
memory: 180Mi
memory: 100Mi
requests:
cpu: 50m
memory: 50Mi
- args:
- --secure-listen-address=$(IP):9243
- --upstream=http://127.0.0.1:9243/

View File

@ -16,9 +16,7 @@ spec:
app: grafana
spec:
containers:
- args:
- -config=/etc/grafana/grafana.ini
image: carlosedp/monitoring-grafana:v5.4.0
- image: carlosedp/monitoring-grafana:v5.4.0
name: grafana
ports:
- containerPort: 3000
@ -117,16 +115,3 @@ spec:
- name: grafana-config
secret:
secretName: grafana-config
volumeClaimTemplate:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: grafana-storage
namespace: monitoring
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi
storageClassName: nfs-ssd-node1

View File

@ -49,7 +49,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: status.podIP
image: carlosedp/kube-rbac-proxy:v0.4.0
image: carlosedp/kube-rbac-proxy:v0.4.1
name: kube-rbac-proxy
ports:
- containerPort: 9100

View File

@ -25,7 +25,7 @@ spec:
- --metrics-relist-interval=1m
- --prometheus-url=http://prometheus-k8s.monitoring.svc:9090/
- --secure-port=6443
image: directxman12/k8s-prometheus-adapter-arm64:v0.4.0
image: directxman12/k8s-prometheus-adapter-arm64:v0.4.1
name: prometheus-adapter
ports:
- containerPort: 6443

View File

@ -0,0 +1,19 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
k8s-app: traefik-ingress-lb
name: traefik-ingress-lb
namespace: monitoring
spec:
endpoints:
- interval: 30s
port: admin
scheme: https
jobLabel: k8s-app
namespaceSelector:
matchNames:
- kube-system
selector:
matchLabels:
k8s-app: traefik-ingress-lb

View File

@ -17,15 +17,15 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
versions+:: {
prometheus: "v2.5.0",
alertmanager: "v0.15.3",
kubeStateMetrics: "v1.4.0",
kubeRbacProxy: "v0.4.0",
kubeStateMetrics: "v1.5.0",
kubeRbacProxy: "v0.4.1",
addonResizer: "2.1",
nodeExporter: "v0.17.0",
prometheusOperator: "v0.26.0",
prometheusAdapter: "v0.4.0",
prometheusOperator: "v0.28.0",
prometheusAdapter: "v0.4.1",
grafana: "v5.4.0",
configmapReloader: "v0.2.2",
prometheusConfigReloader: "v0.26.0",
prometheusConfigReloader: "v0.28.0",
},
imageRepos+:: {
@ -136,38 +136,38 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
},
# Override command for Grafana to load ini from correct path
grafana+:: {
deployment+:
{
local pvc = k.core.v1.persistentVolumeClaim,
spec+: {
volumeClaimTemplate:
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'),
template+: {
spec+: {
containers:
std.map(
function(c)
if c.name == 'grafana' then
c {
args+: [
'-config=/etc/grafana/grafana.ini',
],
}
else
c,
super.containers,
),
},
},
},
},
},
// grafana+:: {
// deployment+:
// {
// local pvc = k.core.v1.persistentVolumeClaim,
// spec+: {
// volumeClaimTemplate:
// 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'),
// template+: {
// spec+: {
// containers:
// std.map(
// function(c)
// if c.name == 'grafana' then
// c {
// args+: [
// '-config=/etc/grafana/grafana.ini',
// ],
// }
// else
// c,
// super.containers,
// ),
// },
// },
// },
// },
// },
// Override command for addon-resizer due to change from parameter --threshold to --acceptance-offset
kubeStateMetrics+:: {

45
traefik.jsonnet Normal file
View File

@ -0,0 +1,45 @@
local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
_config+:: {
namespace: 'monitoring',
},
traefik+:: {
serviceMonitor:
{
apiVersion: 'monitoring.coreos.com/v1',
kind: 'ServiceMonitor',
metadata: {
name: 'traefik-ingress-lb',
namespace: $._config.namespace,
labels: {
'k8s-app': 'traefik-ingress-lb',
},
},
spec: {
jobLabel: 'k8s-app',
selector: {
matchLabels: {
'k8s-app': 'traefik-ingress-lb',
},
},
endpoints: [
{
port: 'admin',
scheme: 'https',
interval: '30s',
},
],
namespaceSelector: {
matchNames: [
'kube-system',
]
},
},
},
},
};
{ ['traefik-' + name]: kp.traefik[name] for name in std.objectFields(kp.traefik) }