This repository has been archived by the owner on Dec 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
node-exporter-works-values-openshift.yaml
231 lines (221 loc) · 9.23 KB
/
node-exporter-works-values-openshift.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# RUN THESE COMMANDS FIRST BEFORE APPLYING THIS FILE
# Note: Scraping the existing node-exporter pods needs TLS and service account and token credentials from openshift-monitoring. Copy them to kubecost project with the following commands:
# oc get secret metrics-client-certs --namespace=openshift-monitoring -o yaml | sed 's/namespace: .*/namespace: kubecost/' | oc apply -f -
# oc create secret generic -n kubecost serviceaccount --from-literal=token=$(oc exec -n openshift-monitoring prometheus-k8s-0 -- cat "/var/run/secrets/kubernetes.io/serviceaccount/token")
# oc get configmap serving-certs-ca-bundle --namespace=openshift-monitoring -o yaml | sed 's/namespace: .*/namespace: kubecost/' | oc apply -f -```
# kubecostProductConfigs:
# clusterName: YOUR_CLUSTER_NAME # Context
# projectID: YOUR_AWS_ACCOUNT_ID
# AWS Cloud Integration
# serviceKeySecretName: kubecost-aws-iam-user
# athenaProjectID: YOUR_AWS_ACCOUNT_ID
# athenaBucketName: s3://aws-athena-query-results-kubecost-YOUR_CLUSTER_NAME
# athenaRegion: YOUR_AWS_REGION
# athenaDatabase: athenacurcfn_kubecost_YOUR_CLUSTER_NAME
# athenaTable: kubecost_YOUR_CLUSTER_NAME
# Spot data
# awsSpotDataRegion: YOUR_AWS_REGION
# awsSpotDataBucket: kubecost-spot-instance-data-feed-YOUR_BUCKET_NAME
# awsSpotDataPrefix: spotdata
# currencyCode: EUR
# Note: the copied service account token expires in 1 year
prometheus:
serverFiles:
prometheus.yml:
scrape_configs:
- job_name: serviceMonitor/openshift-monitoring/node-exporter/0
honor_timestamps: true
scrape_interval: 15s
scrape_timeout: 10s
metrics_path: /metrics
scheme: https
authorization:
type: Bearer
credentials_file: /etc/config/openshift-serviceaccount/token
tls_config:
ca_file: /etc/config/openshift-service-ca/service-ca.crt
cert_file: /etc/config/metrics-client-certs/tls.crt
key_file: /etc/config/metrics-client-certs/tls.key
server_name: node-exporter.openshift-monitoring.svc
insecure_skip_verify: false
follow_redirects: true
relabel_configs:
- source_labels: [job]
separator: ;
regex: (.*)
target_label: __tmp_prometheus_job_name
replacement: $1
action: replace
- source_labels: [__meta_kubernetes_service_label_app_kubernetes_io_component]
separator: ;
regex: exporter
replacement: $1
action: keep
- source_labels: [__meta_kubernetes_service_label_app_kubernetes_io_name]
separator: ;
regex: node-exporter
replacement: $1
action: keep
- source_labels: [__meta_kubernetes_service_label_app_kubernetes_io_part_of]
separator: ;
regex: openshift-monitoring
replacement: $1
action: keep
- source_labels: [__meta_kubernetes_endpoint_port_name]
separator: ;
regex: https
replacement: $1
action: keep
- source_labels: [__meta_kubernetes_endpoint_address_target_kind, __meta_kubernetes_endpoint_address_target_name]
separator: ;
regex: Node;(.*)
target_label: node
replacement: ${1}
action: replace
- source_labels: [__meta_kubernetes_endpoint_address_target_kind, __meta_kubernetes_endpoint_address_target_name]
separator: ;
regex: Pod;(.*)
target_label: pod
replacement: ${1}
action: replace
- source_labels: [__meta_kubernetes_namespace]
separator: ;
regex: (.*)
target_label: namespace
replacement: $1
action: replace
- source_labels: [__meta_kubernetes_service_name]
separator: ;
regex: (.*)
target_label: service
replacement: $1
action: replace
- source_labels: [__meta_kubernetes_pod_name]
separator: ;
regex: (.*)
target_label: pod
replacement: $1
action: replace
- source_labels: [__meta_kubernetes_pod_container_name]
separator: ;
regex: (.*)
target_label: container
replacement: $1
action: replace
- source_labels: [__meta_kubernetes_service_name]
separator: ;
regex: (.*)
target_label: job
replacement: ${1}
action: replace
- source_labels: [__meta_kubernetes_service_label_app_kubernetes_io_name]
separator: ;
regex: (.+)
target_label: job
replacement: ${1}
action: replace
- separator: ;
regex: (.*)
target_label: endpoint
replacement: https
action: replace
- source_labels: [__meta_kubernetes_pod_node_name]
separator: ;
regex: (.*)
target_label: instance
replacement: $1
action: replace
- source_labels: [__address__]
separator: ;
regex: (.*)
modulus: 1
target_label: __tmp_hash
replacement: $1
action: hashmod
- source_labels: [__tmp_hash]
separator: ;
regex: "0"
replacement: $1
action: keep
kubernetes_sd_configs:
- role: endpoints
kubeconfig_file: ""
follow_redirects: true
namespaces:
names:
- openshift-monitoring
- job_name: prometheus
static_configs:
- targets:
- localhost:9090
- bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
job_name: kubernetes-nodes-cadvisor
kubernetes_sd_configs:
- role: node
metric_relabel_configs:
- action: keep
regex: (container_cpu_usage_seconds_total|container_memory_working_set_bytes|container_network_receive_errors_total|container_network_transmit_errors_total|container_network_receive_packets_dropped_total|container_network_transmit_packets_dropped_total|container_memory_usage_bytes|container_cpu_cfs_throttled_periods_total|container_cpu_cfs_periods_total|container_fs_usage_bytes|container_fs_limit_bytes|container_cpu_cfs_periods_total|container_fs_inodes_free|container_fs_inodes_total|container_fs_usage_bytes|container_fs_limit_bytes|container_cpu_cfs_throttled_periods_total|container_cpu_cfs_periods_total|container_network_receive_bytes_total|container_network_transmit_bytes_total|container_fs_inodes_free|container_fs_inodes_total|container_fs_usage_bytes|container_fs_limit_bytes|container_spec_cpu_shares|container_spec_memory_limit_bytes|container_network_receive_bytes_total|container_network_transmit_bytes_total|container_fs_reads_bytes_total|container_network_receive_bytes_total|container_fs_writes_bytes_total|container_fs_reads_bytes_total|cadvisor_version_info)
source_labels:
- __name__
- action: replace
regex: (.+)
source_labels:
- container
target_label: container_name
- action: replace
regex: (.+)
source_labels:
- pod
target_label: pod_name
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
- replacement: kubernetes.default.svc:443
target_label: __address__
- regex: (.+)
replacement: /api/v1/nodes/$1/proxy/metrics/cadvisor
source_labels:
- __meta_kubernetes_node_name
target_label: __metrics_path__
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
nodeExporter:
enabled: false
serviceAccounts:
nodeExporter:
create: false
# kube-state-metrics:
# disabled: true
# server:
# # # Fix: err="open /prometheus/queries.active: permission denied" (kubecost-prometheus-server)
# # securityContext:
# # runAsUser: 0
# global:
# external_labels:
# cluster_id: YOUR_CLUSTER_NAME
# # Extra secrets/configmap mounts that are used in the Prometheus ConfigMap needed for node-exporter
# # We are scraping existing node-exporter pods from openshift-monitoring namespace to avoid running the daemonset again
# extraSecretMounts:
# - name: openshift-serviceaccount-token-mount
# mountPath: /etc/config/openshift-serviceaccount
# secretName: serviceaccount
# readOnly: true
# - name: openshift-metrics-client-mount
# mountPath: /etc/config/metrics-client-certs
# secretName: metrics-client-certs
# readOnly: true
# extraConfigmapMounts:
# - name: openshift-service-ca-mount
# mountPath: /etc/config/openshift-service-ca
# configMap: serving-certs-ca-bundle
# readOnly: true
# # networkCosts:
# # enabled: true
# # # Avoid binding on nodeport 3001
# # port: 9501
# global:
# grafana:
# enabled: false
# proxy: false