From 3408f0c29680d57bf44c7f1ef95a560bf4a3891c Mon Sep 17 00:00:00 2001 From: Lee Verberne Date: Thu, 22 Aug 2019 12:45:27 +0000 Subject: [PATCH 1/3] 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. --- content/en/docs/concepts/configuration/secret.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/content/en/docs/concepts/configuration/secret.md b/content/en/docs/concepts/configuration/secret.md index 6c15dc8bedb31..06495be9a1c90 100644 --- a/content/en/docs/concepts/configuration/secret.md +++ b/content/en/docs/concepts/configuration/secret.md @@ -76,9 +76,12 @@ kubectl create secret generic db-user-pass --from-file=./username.txt --from-fil secret "db-user-pass" 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: - kubectl create secret generic dev-db-secret --from-literal=username=devuser --from-literal=password=S\\!B\\\\*d\\$zDsb +Special characters such as `$`, `\`, `*`, and `!` will be interpreted by your [shell](https://en.wikipedia.org/wiki/Shell_\(computing\)) and require escaping. 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: + +``` +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 >}} From ec2ee9ae300b6050850c0a169268402e5203d499 Mon Sep 17 00:00:00 2001 From: Lee Verberne Date: Thu, 22 Aug 2019 17:13:40 +0200 Subject: [PATCH 2/3] Add reviewer suggested improvement for secret escaping Adding sftim's suggestion phrasing explanation of escaping shell special characters. Co-Authored-By: Tim Bannister --- content/en/docs/concepts/configuration/secret.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/concepts/configuration/secret.md b/content/en/docs/concepts/configuration/secret.md index 06495be9a1c90..ce35cde99e9f9 100644 --- a/content/en/docs/concepts/configuration/secret.md +++ b/content/en/docs/concepts/configuration/secret.md @@ -76,7 +76,7 @@ kubectl create secret generic db-user-pass --from-file=./username.txt --from-fil secret "db-user-pass" created ``` {{< note >}} -Special characters such as `$`, `\`, `*`, and `!` will be interpreted by your [shell](https://en.wikipedia.org/wiki/Shell_\(computing\)) and require escaping. 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: +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: ``` kubectl create secret generic dev-db-secret --from-literal=username=devuser --from-literal=password='S!B\*d$zDsb' From 2478894304b6427d281e373561d86abeb5418d6f Mon Sep 17 00:00:00 2001 From: Lee Verberne Date: Thu, 26 Sep 2019 15:30:02 +0000 Subject: [PATCH 3/3] Make secret escaping instructions consistent --- content/en/docs/concepts/configuration/secret.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/content/en/docs/concepts/configuration/secret.md b/content/en/docs/concepts/configuration/secret.md index ce35cde99e9f9..063129dd3437c 100644 --- a/content/en/docs/concepts/configuration/secret.md +++ b/content/en/docs/concepts/configuration/secret.md @@ -801,14 +801,13 @@ kubectl create secret generic test-db-secret --from-literal=username=testuser -- 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: +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: -```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`). {{< /note >}} Now make the pods: