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 = local armExporter =
container.new('arm-exporter', $._config.imageRepos.armExporter + ':' + $._config.versions.armExporter) + container.new('arm-exporter', $._config.imageRepos.armExporter + ':' + $._config.versions.armExporter) +
container.mixin.resources.withRequests({ cpu: '100m', memory: '180Mi' }) + container.mixin.resources.withRequests({ cpu: '50m', memory: '50Mi' }) +
container.mixin.resources.withLimits({ cpu: '200m', memory: '180Mi' }); container.mixin.resources.withLimits({ cpu: '100m', memory: '100Mi' });
local proxy = local proxy =
container.new('kube-rbac-proxy', $._config.imageRepos.kubeRbacProxy + ':' + $._config.versions.kubeRbacProxy) + container.new('kube-rbac-proxy', $._config.imageRepos.kubeRbacProxy + ':' + $._config.versions.kubeRbacProxy) +
container.withArgs([ container.withArgs([

View File

@ -1,2 +1,3 @@
(import 'operator_stack.jsonnet') + (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 - --kubelet-service=kube-system/kubelet
- --logtostderr=true - --logtostderr=true
- --config-reloader-image=carlosedp/configmap-reload:v0.2.2 - --config-reloader-image=carlosedp/configmap-reload:v0.2.2
- --prometheus-config-reloader=carlosedp/prometheus-config-reloader:v0.26.0 - --prometheus-config-reloader=carlosedp/prometheus-config-reloader:v0.28.0
image: carlosedp/prometheus-operator:v0.26.0 image: carlosedp/prometheus-operator:v0.28.0
name: prometheus-operator name: prometheus-operator
ports: ports:
- containerPort: 8080 - containerPort: 8080

View File

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

View File

@ -16,9 +16,7 @@ spec:
app: grafana app: grafana
spec: spec:
containers: containers:
- args: - image: carlosedp/monitoring-grafana:v5.4.0
- -config=/etc/grafana/grafana.ini
image: carlosedp/monitoring-grafana:v5.4.0
name: grafana name: grafana
ports: ports:
- containerPort: 3000 - containerPort: 3000
@ -117,16 +115,3 @@ spec:
- name: grafana-config - name: grafana-config
secret: secret:
secretName: grafana-config 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: valueFrom:
fieldRef: fieldRef:
fieldPath: status.podIP fieldPath: status.podIP
image: carlosedp/kube-rbac-proxy:v0.4.0 image: carlosedp/kube-rbac-proxy:v0.4.1
name: kube-rbac-proxy name: kube-rbac-proxy
ports: ports:
- containerPort: 9100 - containerPort: 9100

View File

@ -25,7 +25,7 @@ spec:
- --metrics-relist-interval=1m - --metrics-relist-interval=1m
- --prometheus-url=http://prometheus-k8s.monitoring.svc:9090/ - --prometheus-url=http://prometheus-k8s.monitoring.svc:9090/
- --secure-port=6443 - --secure-port=6443
image: directxman12/k8s-prometheus-adapter-arm64:v0.4.0 image: directxman12/k8s-prometheus-adapter-arm64:v0.4.1
name: prometheus-adapter name: prometheus-adapter
ports: ports:
- containerPort: 6443 - 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+:: { versions+:: {
prometheus: "v2.5.0", prometheus: "v2.5.0",
alertmanager: "v0.15.3", alertmanager: "v0.15.3",
kubeStateMetrics: "v1.4.0", kubeStateMetrics: "v1.5.0",
kubeRbacProxy: "v0.4.0", kubeRbacProxy: "v0.4.1",
addonResizer: "2.1", addonResizer: "2.1",
nodeExporter: "v0.17.0", nodeExporter: "v0.17.0",
prometheusOperator: "v0.26.0", prometheusOperator: "v0.28.0",
prometheusAdapter: "v0.4.0", prometheusAdapter: "v0.4.1",
grafana: "v5.4.0", grafana: "v5.4.0",
configmapReloader: "v0.2.2", configmapReloader: "v0.2.2",
prometheusConfigReloader: "v0.26.0", prometheusConfigReloader: "v0.28.0",
}, },
imageRepos+:: { imageRepos+:: {
@ -136,38 +136,38 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + {
}, },
# Override command for Grafana to load ini from correct path # Override command for Grafana to load ini from correct path
grafana+:: { // grafana+:: {
deployment+: // deployment+:
{ // {
local pvc = k.core.v1.persistentVolumeClaim, // local pvc = k.core.v1.persistentVolumeClaim,
spec+: { // spec+: {
volumeClaimTemplate: // volumeClaimTemplate:
pvc.new() + // pvc.new() +
pvc.mixin.metadata.withNamespace($._config.namespace) + // pvc.mixin.metadata.withNamespace($._config.namespace) +
pvc.mixin.metadata.withName("grafana-storage") + // pvc.mixin.metadata.withName("grafana-storage") +
pvc.mixin.spec.withAccessModes('ReadWriteMany') + // pvc.mixin.spec.withAccessModes('ReadWriteMany') +
pvc.mixin.spec.resources.withRequests({ storage: '2Gi' }) + // pvc.mixin.spec.resources.withRequests({ storage: '2Gi' }) +
pvc.mixin.spec.withStorageClassName('nfs-ssd-node1'), // pvc.mixin.spec.withStorageClassName('nfs-ssd-node1'),
template+: { // template+: {
spec+: { // spec+: {
containers: // containers:
std.map( // std.map(
function(c) // function(c)
if c.name == 'grafana' then // if c.name == 'grafana' then
c { // c {
args+: [ // args+: [
'-config=/etc/grafana/grafana.ini', // '-config=/etc/grafana/grafana.ini',
], // ],
} // }
else // else
c, // c,
super.containers, // super.containers,
), // ),
}, // },
}, // },
}, // },
}, // },
}, // },
// Override command for addon-resizer due to change from parameter --threshold to --acceptance-offset // Override command for addon-resizer due to change from parameter --threshold to --acceptance-offset
kubeStateMetrics+:: { 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) }