diff --git a/production/kubernetes/build/templates/operator/main.jsonnet b/production/kubernetes/build/templates/operator/main.jsonnet index dda322bac503..fe49426c4fa4 100644 --- a/production/kubernetes/build/templates/operator/main.jsonnet +++ b/production/kubernetes/build/templates/operator/main.jsonnet @@ -101,7 +101,7 @@ local ksm = import 'kube-state-metrics/kube-state-metrics.libsonnet'; name='kubelet-monitor', namespace=this._config.namespace, monitorLabels={ instance: 'primary' }, - targetNamespace=this._config.namespace, + targetNamespace='default', targetLabels={ 'app.kubernetes.io/name': 'kubelet' }, jobLabel=this._config.kubelet_job, metricsPath='/metrics', @@ -110,9 +110,9 @@ local ksm = import 'kube-state-metrics/kube-state-metrics.libsonnet'; ), mon_util.newKubernetesMonitor( name='cadvisor-monitor', - namespace='default', + namespace=this._config.namespace, monitorLabels={ instance: 'primary' }, - targetNamespace=this._config.namespace, + targetNamespace='default', targetLabels={ 'app.kubernetes.io/name': 'kubelet' }, jobLabel=this._config.cadvisor_job, metricsPath='/metrics/cadvisor', diff --git a/production/operator/templates/agent-operator.yaml b/production/operator/templates/agent-operator.yaml index 797ce35fa972..ba8c08e75e6f 100644 --- a/production/operator/templates/agent-operator.yaml +++ b/production/operator/templates/agent-operator.yaml @@ -563,83 +563,83 @@ kind: ServiceMonitor metadata: labels: instance: primary - name: ksm-monitor + name: cadvisor-monitor namespace: ${NAMESPACE} spec: endpoints: - - honorLabels: true + - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token + honorLabels: true interval: 60s - path: /metrics - port: http-metrics + path: /metrics/cadvisor + port: https-metrics relabelings: + - sourceLabels: + - __metrics_path__ + targetLabel: metrics_path - action: replace - replacement: kube-state-metrics + replacement: cadvisor targetLabel: job + scheme: https + tlsConfig: + insecureSkipVerify: true namespaceSelector: matchNames: - - ${NAMESPACE} + - default selector: matchLabels: - app.kubernetes.io/name: kube-state-metrics + app.kubernetes.io/name: kubelet --- apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: labels: instance: primary - name: kubelet-monitor + name: ksm-monitor namespace: ${NAMESPACE} spec: endpoints: - - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token - honorLabels: true + - honorLabels: true interval: 60s path: /metrics - port: https-metrics + port: http-metrics relabelings: - - sourceLabels: - - __metrics_path__ - targetLabel: metrics_path - action: replace - replacement: kubelet + replacement: kube-state-metrics targetLabel: job - scheme: https - tlsConfig: - insecureSkipVerify: true namespaceSelector: matchNames: - ${NAMESPACE} selector: matchLabels: - app.kubernetes.io/name: kubelet + app.kubernetes.io/name: kube-state-metrics --- apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: labels: instance: primary - name: cadvisor-monitor - namespace: default + name: kubelet-monitor + namespace: ${NAMESPACE} spec: endpoints: - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token honorLabels: true interval: 60s - path: /metrics/cadvisor + path: /metrics port: https-metrics relabelings: - sourceLabels: - __metrics_path__ targetLabel: metrics_path - action: replace - replacement: cadvisor + replacement: kubelet targetLabel: job scheme: https tlsConfig: insecureSkipVerify: true namespaceSelector: matchNames: - - ${NAMESPACE} + - default selector: matchLabels: app.kubernetes.io/name: kubelet