Skip to content
This repository was archived by the owner on Apr 12, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 8 additions & 9 deletions manifests-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}}",
Expand Down Expand Up @@ -2536,7 +2537,6 @@ data:
kubernetes_sd_configs:
- role: node
relabel_configs:
- action: labelmap
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
- target_label: __address__
Expand All @@ -2545,7 +2545,6 @@ data:
regex: (.+)
target_label: __metrics_path__
replacement: /api/v1/nodes/${1}/proxy/metrics/cadvisor

kind: ConfigMap
metadata:
creationTimestamp: null
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -2677,7 +2676,7 @@ spec:
protocol: TCP
selector:
app: kube-state-metrics

---
apiVersion: extensions/v1beta1
kind: DaemonSet
Expand Down
2 changes: 1 addition & 1 deletion manifests/grafana/import-dashboards/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}",
Expand Down