Fix code blocks secret.md (#13016)

The formatting is currently broken because code blocks are not correctly terminated.
This commit is contained in:
Jan Dolecek 2019-04-10 09:46:12 +02:00 committed by Kubernetes Prow Robot
parent 2e3a25069d
commit ca83644032
1 changed files with 23 additions and 0 deletions

View File

@ -521,12 +521,15 @@ ls /etc/foo/
username
password
```
```shell
cat /etc/foo/username
```
```
admin
```
```shell
cat /etc/foo/password
```
@ -694,9 +697,11 @@ start until all the pod's volumes are mounted.
### Use-Case: Pod with ssh keys
Create a kustomization.yaml with SecretGenerator containing some ssh keys:
```shell
kubectl create secret generic ssh-key-secret --from-file=ssh-privatekey=/path/to/.ssh/id_rsa --from-file=ssh-publickey=/path/to/.ssh/id_rsa.pub
```
```
secret "ssh-key-secret" created
```
@ -746,6 +751,7 @@ credentials and another pod which consumes a secret with test environment
credentials.
Make the kustomization.yaml with SecretGenerator
```shell
kubectl create secret generic prod-db-secret --from-literal=username=produser --from-literal=password=Y4nys7f11
```
@ -753,6 +759,23 @@ kubectl create secret generic prod-db-secret --from-literal=username=produser --
secret "prod-db-secret" created
```
```shell
kubectl create secret generic test-db-secret --from-literal=username=testuser --from-literal=password=iluvtests
```
```
secret "test-db-secret" created
```
{{< note >}}
Special characters such as `$`, `\*`, and `!` require escaping.
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
```
You do not need to escape special characters in passwords from files (`--from-file`).
{{< /note >}}
Now make the pods:
```shell