diff --git a/content/en/docs/concepts/configuration/secret.md b/content/en/docs/concepts/configuration/secret.md index 44c1c0d066..96d97720f1 100644 --- a/content/en/docs/concepts/configuration/secret.md +++ b/content/en/docs/concepts/configuration/secret.md @@ -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