Skip to content

Commit dea4f2b

Browse files
authored
Merge pull request #31763 from sgaist/patch-1
Add secure example for getting secret values
2 parents 189100f + 73bd456 commit dea4f2b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

content/en/docs/tasks/configmap-secret/managing-secret-using-kubectl.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ The output is similar to:
130130
Now you can decode the `password` data:
131131

132132
```shell
133+
# This is an example for documentation purposes.
134+
# If you did things this way, the data 'MWYyZDFlMmU2N2Rm' could be stored in
135+
# your shell history.
136+
# Someone with access to you computer could find that remembered command
137+
# and base-64 decode the secret, perhaps without your knowledge.
138+
# It's usually better to combine the steps, as shown later in the page.
133139
echo 'MWYyZDFlMmU2N2Rm' | base64 --decode
134140
```
135141

@@ -139,6 +145,15 @@ The output is similar to:
139145
1f2d1e2e67df
140146
```
141147

148+
In order to avoid storing a secret encoded value in your shell history, you can
149+
run the following command:
150+
151+
```shell
152+
kubectl get secret db-user-pass -o jsonpath='{.data.password}' | base64 --decode
153+
```
154+
155+
The output shall be similar as above.
156+
142157
## Clean Up
143158

144159
Delete the Secret you created:

0 commit comments

Comments
 (0)