From 727ee821bd48526c6979a99eb2f074bbf41aa598 Mon Sep 17 00:00:00 2001 From: ido Date: Thu, 14 May 2020 14:07:29 +0900 Subject: [PATCH 1/2] adding namespace is not necessary now. it just duplicated. --- build.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/build.sh b/build.sh index ced5bc8..e4272db 100755 --- a/build.sh +++ b/build.sh @@ -5,32 +5,24 @@ kubectl --namespace monitoring create configmap --dry-run prometheus-rules \ --from-file=configs/prometheus/rules \ --output yaml \ > ./manifests/prometheus/prometheus-rules.yaml -# Workaround since `--namespace monitoring` from above is not preserved -echo " namespace: monitoring" >> ./manifests/prometheus/prometheus-rules.yaml # Create ConfigMap for an external url kubectl --namespace monitoring create configmap --dry-run alertmanager-templates \ --from-file=configs/alertmanager-templates \ --output yaml \ > ./manifests/alertmanager/alertmanager-templates.yaml -# Workaround since `--namespace monitoring` from above is not preserved -echo " namespace: monitoring" >> ./manifests/alertmanager/alertmanager-templates.yaml # Create ConfigMap with Grafana dashboards and datasources kubectl --namespace monitoring create configmap --dry-run grafana-import-dashboards \ --from-file=configs/grafana \ --output yaml \ > ./manifests/grafana/import-dashboards/configmap.yaml -# Workaround since `--namespace monitoring` from above is not preserved -echo " namespace: monitoring" >> ./manifests/grafana/import-dashboards/configmap.yaml # Create ConfigMap with Prometheus config kubectl --namespace monitoring create configmap --dry-run prometheus-core \ --from-file=configs/prometheus/prometheus.yaml \ --output yaml \ > ./manifests/prometheus/configmap.yaml -# Workaround since `--namespace monitoring` from above is not preserved -echo " namespace: monitoring" >> ./manifests/prometheus/configmap.yaml # Create one single manifest file target="./manifests-all.yaml" From d1449a744db485b5c9e683e7c6e544e93e349372 Mon Sep 17 00:00:00 2001 From: ido Date: Thu, 14 May 2020 14:21:57 +0900 Subject: [PATCH 2/2] ./build.sh generates this commit --- manifests-all.yaml | 17 ++++++++--------- .../grafana/import-dashboards/configmap.yaml | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/manifests-all.yaml b/manifests-all.yaml index de31082..62aca9b 100644 --- a/manifests-all.yaml +++ b/manifests-all.yaml @@ -5,7 +5,8 @@ kind: Namespace metadata: name: monitoring --- -apiVersion: rbac.authorization.k8s.io/v1beta1 +--- +apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: prometheus @@ -18,7 +19,7 @@ subjects: name: prometheus-k8s namespace: monitoring --- -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: prometheus @@ -536,7 +537,7 @@ data: "show": false }, "targets": [{ - "expr": "(time() - container_start_time_seconds{container_name=\"kube-apiserver\"})", + "expr": "(time() - process_start_time_seconds{job=\"prometheus\"})", "intervalFactor": 2, "refId": "A", "step": 4 @@ -998,7 +999,7 @@ data: "stack": false, "steppedLine": false, "targets": [{ - "expr": "prometheus_evaluator_duration_seconds{quantile!=\"0.01\", quantile!=\"0.05\"}", + "expr": "prometheus_evaluator_duration_milliseconds{quantile!=\"0.01\", quantile!=\"0.05\"}", "interval": "", "intervalFactor": 2, "legendFormat": "{{quantile}}", @@ -2536,7 +2537,6 @@ data: kubernetes_sd_configs: - role: node relabel_configs: - - action: labelmap - action: labelmap regex: __meta_kubernetes_node_label_(.+) - target_label: __address__ @@ -2545,7 +2545,6 @@ data: regex: (.+) target_label: __metrics_path__ replacement: /api/v1/nodes/${1}/proxy/metrics/cadvisor - kind: ConfigMap metadata: creationTimestamp: null @@ -2621,7 +2620,7 @@ spec: - containerPort: 8080 --- # --- -# apiVersion: rbac.authorization.k8s.io/v1beta1 +# apiVersion: rbac.authorization.k8s.io/v1 # kind: ClusterRoleBinding # metadata: # name: kube-state-metrics @@ -2634,7 +2633,7 @@ spec: # name: kube-state-metrics # namespace: monitoring # --- -# apiVersion: rbac.authorization.k8s.io/v1beta1 +# apiVersion: rbac.authorization.k8s.io/v1 # kind: ClusterRole # metadata: # name: kube-state-metrics @@ -2677,7 +2676,7 @@ spec: protocol: TCP selector: app: kube-state-metrics - + --- apiVersion: extensions/v1beta1 kind: DaemonSet diff --git a/manifests/grafana/import-dashboards/configmap.yaml b/manifests/grafana/import-dashboards/configmap.yaml index f0de987..1f8ad28 100644 --- a/manifests/grafana/import-dashboards/configmap.yaml +++ b/manifests/grafana/import-dashboards/configmap.yaml @@ -1465,7 +1465,7 @@ data: "stack": false, "steppedLine": false, "targets": [{ - "expr": "sum(rate(container_cpu_usage_seconds_total{image!=\"\",name=~\"^k8s_.*\",kubernetes_io_hostname=~\"^$Node$\"}[1m])) by (pod_name)", + "expr": "sum(rate(container_cpu_usage_seconds_total{image!=\"\",name=~\"^k8s_.*\",instance=~\"^$instance$\",namespace=~\"^$namespace$\"}[1m])) by (pod_name)", "interval": "", "intervalFactor": 2, "legendFormat": "{{ pod_name }}",