Fix incorrect advice about creating a secret (#16004)
* Fix incorrect advice about creating a secret The existing command does not use code style as required by the style guide and it is incorrect as rendered. Also, there's an easier way to do this. * Add reviewer suggested improvement for secret escaping Adding sftim's suggestion phrasing explanation of escaping shell special characters. Co-Authored-By: Tim Bannister <tim@scalefactory.com> * Make secret escaping instructions consistent
This commit is contained in:
parent
6e07eee895
commit
fbc03c8ec6
|
|
@ -76,9 +76,12 @@ kubectl create secret generic db-user-pass --from-file=./username.txt --from-fil
|
||||||
secret "db-user-pass" created
|
secret "db-user-pass" created
|
||||||
```
|
```
|
||||||
{{< note >}}
|
{{< note >}}
|
||||||
Special characters such as `$`, `\*`, and `!` require escaping.
|
Special characters such as `$`, `\`, `*`, and `!` will be interpreted by your [shell](https://en.wikipedia.org/wiki/Shell_\(computing\)) and require escaping. In most common shells, the easiest way to escape the password is to surround it with single quotes (`'`). For example, if your actual password is `S!B\*d$zDsb`, you should execute the command this way:
|
||||||
If the password you are using has special characters, you need to escape them using the `\\` character. For example, if your actual password is `S!B\*d$zDsb`, you should execute the command this way:
|
|
||||||
kubectl create secret generic dev-db-secret --from-literal=username=devuser --from-literal=password=S\\!B\\\\*d\\$zDsb
|
```
|
||||||
|
kubectl create secret generic dev-db-secret --from-literal=username=devuser --from-literal=password='S!B\*d$zDsb'
|
||||||
|
```
|
||||||
|
|
||||||
You do not need to escape special characters in passwords from files (`--from-file`).
|
You do not need to escape special characters in passwords from files (`--from-file`).
|
||||||
{{< /note >}}
|
{{< /note >}}
|
||||||
|
|
||||||
|
|
@ -794,11 +797,10 @@ kubectl create secret generic test-db-secret --from-literal=username=testuser --
|
||||||
secret "test-db-secret" created
|
secret "test-db-secret" created
|
||||||
```
|
```
|
||||||
{{< note >}}
|
{{< note >}}
|
||||||
Special characters such as `$`, `\*`, and `!` require escaping.
|
Special characters such as `$`, `\`, `*`, and `!` will be interpreted by your [shell](https://en.wikipedia.org/wiki/Shell_\(computing\)) and require escaping. In most common shells, the easiest way to escape the password is to surround it with single quotes (`'`). For example, if your actual password is `S!B\*d$zDsb`, you should execute the command this way:
|
||||||
If the password you are using has special characters, you need to escape them using the `\\` character. For example, if your actual password is `S!B\*d$zDsb`, you should execute the command this way:
|
|
||||||
|
|
||||||
```shell
|
```
|
||||||
kubectl create secret generic dev-db-secret --from-literal=username=devuser --from-literal=password=S\\!B\\\*d\\$zDsb
|
kubectl create secret generic dev-db-secret --from-literal=username=devuser --from-literal=password='S!B\*d$zDsb'
|
||||||
```
|
```
|
||||||
|
|
||||||
You do not need to escape special characters in passwords from files (`--from-file`).
|
You do not need to escape special characters in passwords from files (`--from-file`).
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue