Skip to content

Commit 895d6f9

Browse files
authored
Merge pull request #44713 from bburt-rh/RHDEVDOCS-3917-document-new-auth-methods-for-remote_write
RHDEVDOCS-3917 - document new authentication methods for remote_write in monitoring
2 parents e09340f + 15fa224 commit 895d6f9

File tree

3 files changed

+340
-111
lines changed

3 files changed

+340
-111
lines changed

modules/monitoring-configuring-remote-write-storage.adoc

Lines changed: 22 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,25 @@ Doing so has no impact on how or for how long Prometheus stores metrics.
2121
* You have installed the OpenShift CLI (`oc`).
2222
* You have set up a remote write compatible endpoint (such as Thanos) and know the endpoint URL.
2323
See the link:https://prometheus.io/docs/operating/integrations/#remote-endpoints-and-storage[Prometheus remote endpoints and storage documentation] for information about endpoints that are compatible with the remote write feature.
24-
* You have set up authentication credentials for the remote write endpoint.
24+
* You have set up authentication credentials in a `Secret` object for the remote write endpoint.
25+
You must create the secret in the same namespace as the Prometheus object for which you configure remote write: the `openshift-monitoring` namespace for default platform monitoring or the `openshift-user-workload-monitoring` namespace for user workload monitoring.
26+
2527
+
2628
[CAUTION]
2729
====
28-
To reduce security risks, avoid sending metrics to an endpoint via unencrypted HTTP or without using authentication.
30+
To reduce security risks, use HTTPS and authentication to send metrics to an endpoint.
2931
====
3032

3133
.Procedure
3234

35+
Follow these steps to configure remote write for default platform monitoring in the `cluster-monitoring-config` config map in the `openshift-monitoring` namespace.
36+
37+
[NOTE]
38+
====
39+
If you configure remote write for the Prometheus instance that monitors user-defined projects, make similar edits to the `user-workload-monitoring-config` config map in the `openshift-user-workload-monitoring` namespace.
40+
Note that the Prometheus config map component is called `prometheus` in the `user-workload-monitoring-config` `ConfigMap` object and not `prometheusK8s`, as it is in the `cluster-monitoring-config` `ConfigMap` object.
41+
====
42+
3343
. Edit the `cluster-monitoring-config` `ConfigMap` object in the `openshift-monitoring` project:
3444
+
3545
[source,terminal]
@@ -52,89 +62,14 @@ data:
5262
config.yaml: |
5363
prometheusK8s:
5464
remoteWrite:
55-
- url: "https://remote-write.endpoint"
56-
<endpoint_authentication_credentials>
57-
----
58-
+
59-
For `endpoint_authentication_credentials` substitute the credentials for the endpoint.
60-
Currently supported authentication methods are basic authentication (`basicAuth`) and client TLS (`tlsConfig`) authentication.
61-
+
62-
* The following example configures basic authentication:
63-
+
64-
[source,yaml]
65-
----
66-
basicAuth:
67-
username:
68-
<usernameSecret>
69-
password:
70-
<passwordSecret>
71-
----
72-
Substitute `<usernameSecret>` and `<passwordSecret>` accordingly.
73-
+
74-
The following sample shows basic authentication configured with `remoteWriteAuth` for the `name` values and `user` and `password` for the `key` values. These values contain the endpoint authentication credentials:
75-
+
76-
[source,yaml]
77-
----
78-
apiVersion: v1
79-
kind: ConfigMap
80-
metadata:
81-
name: cluster-monitoring-config
82-
namespace: openshift-monitoring
83-
data:
84-
config.yaml: |
85-
prometheusK8s:
86-
remoteWrite:
87-
- url: "https://remote-write.endpoint"
88-
basicAuth:
89-
username:
90-
name: remoteWriteAuth
91-
key: user
92-
password:
93-
name: remoteWriteAuth
94-
key: password
95-
----
96-
+
97-
* The following example configures client TLS authentication:
98-
+
99-
[source,yaml]
100-
----
101-
tlsConfig:
102-
ca:
103-
<caSecret>
104-
cert:
105-
<certSecret>
106-
keySecret:
107-
<keySecret>
65+
- url: "https://remote-write-endpoint.example.com" <1>
66+
<endpoint_authentication_credentials> <2>
10867
----
109-
Substitute `<caSecret>`, `<certSecret>`, and `<keySecret>` accordingly.
11068
+
111-
The following sample shows a TLS authentication configuration using `selfsigned-mtls-bundle` for the `name` values and `ca.crt` for the `ca` `key` value, `client.crt` for the `cert` `key` value, and `client.key` for the `keySecret` `key` value:
112-
+
113-
[source,yaml]
114-
----
115-
apiVersion: v1
116-
kind: ConfigMap
117-
metadata:
118-
name: cluster-monitoring-config
119-
namespace: openshift-monitoring
120-
data:
121-
config.yaml: |
122-
prometheusK8s:
123-
remoteWrite:
124-
- url: "https://remote-write.endpoint"
125-
tlsConfig:
126-
ca:
127-
secret:
128-
name: selfsigned-mtls-bundle
129-
key: ca.crt
130-
cert:
131-
secret:
132-
name: selfsigned-mtls-bundle
133-
key: client.crt
134-
keySecret:
135-
name: selfsigned-mtls-bundle
136-
key: client.key
137-
----
69+
<1> The URL of the remote write endpoint.
70+
<2> The authentication method and credentials for the endpoint.
71+
Currently supported authentication methods are AWS Signature Version 4, authentication using HTTP an `Authorization` request header, basic authentication, OAuth 2.0, and TLS client.
72+
See _Supported remote write authentication settings_ below for sample configurations of supported authentication methods.
13873

13974
. Add write relabel configuration values after the authentication credentials:
14075
+
@@ -149,10 +84,11 @@ data:
14984
config.yaml: |
15085
prometheusK8s:
15186
remoteWrite:
152-
- url: "https://remote-write.endpoint"
87+
- url: "https://remote-write-endpoint.example.com"
15388
<endpoint_authentication_credentials>
154-
<write_relabel_configs>
89+
<write_relabel_configs> <1>
15590
----
91+
<1> The write relabel configuration settings.
15692
+
15793
For `<write_relabel_configs>` substitute a list of write relabel configurations for metrics that you want to send to the remote endpoint.
15894
+
@@ -169,7 +105,7 @@ data:
169105
config.yaml: |
170106
prometheusK8s:
171107
remoteWrite:
172-
- url: "https://remote-write.endpoint"
108+
- url: "https://remote-write-endpoint.example.com"
173109
writeRelabelConfigs:
174110
- sourceLabels: [__name__]
175111
regex: 'my_metric'
@@ -179,29 +115,6 @@ data:
179115
+
180116
See the link:https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config[Prometheus relabel_config documentation] for information about write relabel configuration options.
181117
182-
. If required, configure remote write for the Prometheus instance that monitors user-defined projects by changing the `name` and `namespace` `metadata` values as follows:
183-
+
184-
[source,yaml]
185-
----
186-
apiVersion: v1
187-
kind: ConfigMap
188-
metadata:
189-
name: user-workload-monitoring-config
190-
namespace: openshift-user-workload-monitoring
191-
data:
192-
config.yaml: |
193-
prometheus:
194-
remoteWrite:
195-
- url: "https://remote-write.endpoint"
196-
<endpoint_authentication_credentials>
197-
<write_relabel_configs>
198-
----
199-
+
200-
[NOTE]
201-
====
202-
The Prometheus config map component is called `prometheusK8s` in the `cluster-monitoring-config` `ConfigMap` object and `prometheus` in the `user-workload-monitoring-config` `ConfigMap` object.
203-
====
204-
205118
. Save the file to apply the changes to the `ConfigMap` object.
206119
The pods affected by the new configuration restart automatically.
207120
+
@@ -214,4 +127,3 @@ Configurations applied to the `user-workload-monitoring-config` `ConfigMap` obje
214127
====
215128
Saving changes to a monitoring `ConfigMap` object might redeploy the pods and other resources in the related project. Saving changes might also restart the running monitoring processes in that project.
216129
====
217-

0 commit comments

Comments
 (0)