Skip to content

Commit c63ce32

Browse files
committed
updated commands to get tokens for service account
1 parent 1e85f1b commit c63ce32

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

src/common/de/monitoring_openshift.asciidoc

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,19 +201,12 @@ Um das Token auszulesen, welches Sie später in {CMK} in der Regel für den Spez
201201

202202
[{shell}]
203203
----
204-
{c-user} oc get secret $(oc get serviceaccount checkmk -o=jsonpath='{.secrets[0].name}' -n checkmk-monitoring) -n checkmk-monitoring -o=jsonpath='{.data.token}' | base64 --decode
204+
{c-user} oc get secret $(oc describe sa checkmk -n checkmk-monitoring | grep 'Tokens' | awk '{ print $2 }') -n checkmk-monitoring -o=jsonpath='{.data.token}' | base64 --decode
205205
eyJhbGciOiJSUzI1NiIsImtpZCI6IkxFbDdZb25t...
206206
----
207207

208208
Lassen Sie die Shell mit diesen Informationen geöffnet oder kopieren Sie das Token an einen Ort, auf den Sie während der folgenden Einrichtung in {CMK} zugreifen können.
209209

210-
*Hinweis:* Der Service-Account wird in OpenShift mit zwei Secrets erzeugt. Da nicht vorhersehbar ist, welches den Token enthält, kann es sein, dass die Ausgabe den obigen Befehls einfach leer ist.
211-
Ändern Sie in diesem Fall den Index des ausgelesenen Array-Elementes (die Zahl in den eckigen Klammern hinter `.secrets`) von `0` auf `1` ab:
212-
213-
[{shell}]
214-
----
215-
{c-user} oc get secret $(oc get serviceaccount checkmk -o=jsonpath='{.secrets[1].name}' -n checkmk-monitoring) -n checkmk-monitoring -o=jsonpath='{.data.token}' | base64 --decode
216-
----
217210

218211
[#get_certificate]
219212
==== Zertifikat auslesen
@@ -222,7 +215,7 @@ Um das Zertifikat auszulesen, welches Sie später in {CMK} in den [.guihint]#Glo
222215

223216
[{shell}]
224217
----
225-
{c-user} oc get secret $(oc get serviceaccount checkmk -o=jsonpath='{.secrets[0].name}' -n checkmk-monitoring) -n checkmk-monitoring -o=jsonpath='{.data.ca\.crt}' | base64 --decode
218+
{c-user} oc get secret $(oc describe sa checkmk -n checkmk-monitoring | grep 'Tokens' | awk '{ print $2 }') -n checkmk-monitoring -o=jsonpath='{.data.ca\.crt}' | base64 --decode
226219
----
227220

228221
Lassen Sie die Shell mit diesen Informationen geöffnet oder kopieren Sie das Zertifikat – inklusive der Zeilen `BEGIN CERTIFICATE` und `END CERTIFICATE` – an einen Ort, auf den Sie während der folgenden Einrichtung in {CMK} zugreifen können.

src/common/en/monitoring_openshift.asciidoc

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,12 @@ The following command can be used to read out the token, which is usually the on
136136

137137
[{shell}]
138138
----
139-
{c-user} oc get secret $(oc get serviceaccount checkmk -o=jsonpath='{.secrets[0].name}' -n checkmk-monitoring) -n checkmk-monitoring -o=jsonpath='{.data.token}' | base64 --decode
139+
{c-user} oc get secret $(oc describe sa checkmk -n checkmk-monitoring | grep 'Tokens' | awk '{ print $2 }') -n checkmk-monitoring -o=jsonpath='{.data.token}' | base64 --decode
140140
eyJhbGciOiJSUzI1NiIsImtpZCI6IkxFbDdZb25t...
141141
----
142142

143143
Leave the shell open with this information or copy the token to a location that you can access during the following setup in {CMK}.
144144

145-
*Note:* The service account is created in OpenShift with two secrets. Since it is unpredictable which of these will contain the token, the output from the above command may simply be empty.
146-
In this case, change the index of the retrieved array element (the number in the square brackets following `.secrets`) from `0` to `1`:
147-
148-
[{shell}]
149-
----
150-
{c-user} oc get secret $(oc get serviceaccount checkmk -o=jsonpath='{.secrets[1].name}' -n checkmk-monitoring) -n checkmk-monitoring -o=jsonpath='{.data.token}' | base64 --decode
151-
----
152-
153145

154146
[#get_certificate]
155147
==== Retrieve the certificate
@@ -158,7 +150,7 @@ The following command can be used to retrieve the certificate which you will lat
158150

159151
[{shell}]
160152
----
161-
{c-user} oc get secret $(oc get serviceaccount checkmk -o=jsonpath='{.secrets[0].name}' -n checkmk-monitoring) -n checkmk-monitoring -o=jsonpath='{.data.ca\.crt}' | base64 --decode
153+
{c-user} oc get secret $(oc describe sa checkmk -n checkmk-monitoring | grep 'Tokens' | awk '{ print $2 }') -n checkmk-monitoring -o=jsonpath='{.data.ca\.crt}' | base64 --decode
162154
----
163155

164156
Leave the shell open with this information, or copy the certificate -- including the `BEGIN CERTIFICATE` and `END CERTIFICATE` lines -- to a location that you can access during the following setup in {CMK}.

0 commit comments

Comments
 (0)