@@ -15,8 +15,9 @@ These steps are not required for an external Prometheus source.
15
15
16
16
You must perform the following tasks, as described in this section:
17
17
18
- * Create a service account to get a token.
19
- * Create the service token.
18
+ * Create a service account.
19
+ * Create a secret that generates a token for the service account.
20
+ * Create the trigger authentication.
20
21
* Create a role.
21
22
* Add that role to the service account.
22
23
* Reference the token in the trigger authentication object used by Prometheus.
@@ -38,49 +39,49 @@ You must perform the following tasks, as described in this section:
38
39
$ oc project my-project
39
40
----
40
41
41
- . Use the following command to create a service account, if your cluster does not have one:
42
+ . Create a service account and token, if your cluster does not have one:
43
+
44
+ .. Create a `service account` object by using the following command:
42
45
+
43
46
[source,terminal]
44
47
----
45
- $ oc create serviceaccount < service _account >
48
+ $ oc create serviceaccount thanos <1 >
46
49
----
47
50
+
48
- where:
49
- +
50
- <service _account >:: Specifies the name of the service account.
51
+ <1> Specifies the name of the service account.
51
52
52
- . Use the following command to create the service token for the service account:
53
+ .. Create a `secret` YAML to generate a service account token :
53
54
+
54
- [source,terminal ]
55
+ [source,yaml ]
55
56
----
56
- $ oc apply -f - <<EOF
57
57
apiVersion: v1
58
58
kind: Secret
59
59
metadata:
60
60
name: thanos-token
61
61
annotations:
62
- kubernetes.io/service-account.name: < service _account >
62
+ kubernetes.io/service-account.name: thanos <1 >
63
63
type: kubernetes.io/service-account-token
64
- EOF
65
64
----
66
65
+
67
- where:
66
+ <1> Specifies the name of the service account.
67
+
68
+ .. Create the secret object by using the following command:
68
69
+
69
- <service _account >:: Specifies the name of the service account.
70
+ [source,terminal]
71
+ ----
72
+ $ oc create -f <file_name>.yaml
73
+ ----
70
74
71
75
.. Use the following command to locate the token assigned to the service account:
72
76
+
73
77
[source,terminal]
74
78
----
75
- $ oc describe serviceaccount <service_account >
79
+ $ oc describe serviceaccount thanos <1 >
76
80
----
77
81
+
78
- --
79
- where:
80
-
81
- <service _account >:: Specifies the name of the service account.
82
- --
82
+ <1> Specifies the name of the service account.
83
83
+
84
+ --
84
85
.Example output
85
86
[source,terminal]
86
87
----
@@ -90,11 +91,12 @@ Labels: <none>
90
91
Annotations: <none >
91
92
Image pull secrets: thanos-dockercfg-nnwgj
92
93
Mountable secrets: thanos-dockercfg-nnwgj
93
- Tokens: thanos-token-9g4n5 <1>
94
+ Tokens: thanos-token <1>
94
95
Events: <none >
95
96
96
97
----
97
98
<1> Use this token in the trigger authentication.
99
+ --
98
100
99
101
. Create a trigger authentication with the service account token:
100
102
@@ -109,10 +111,10 @@ metadata:
109
111
spec:
110
112
secretTargetRef: <1>
111
113
- parameter: bearerToken <2>
112
- name: thanos-token-9g4n5 <3>
114
+ name: thanos-token <3>
113
115
key: token <4>
114
116
- parameter: ca
115
- name: thanos-token-9g4n5
117
+ name: thanos-token
116
118
key: ca.crt
117
119
----
118
120
<1> Specifies that this object uses a secret for authorization.
@@ -186,6 +188,7 @@ subjects:
186
188
<2> Specifies the namespace of the object you want to scale.
187
189
<3> Specifies the name of the service account to bind to the role.
188
190
<4> Specifies the namespace of the object you want to scale.
191
+
189
192
.. Create the CR object:
190
193
+
191
194
[source,terminal]
@@ -200,4 +203,3 @@ You can now deploy a scaled object or scaled job to enable autoscaling for your
200
203
* `triggers.metadata.authModes` must be `bearer`
201
204
* `triggers.metadata.namespace` must be set to the namespace of the object to scale
202
205
* `triggers.authenticationRef` must point to the trigger authentication resource specified in the previous step
203
-
0 commit comments