Skip to content

Commit 13c1c46

Browse files
committed
Clean up docker config secrets section
- Move explanations into a bulleted list with some style cleanup for consistency in the list - Improve the readability of the commands
1 parent fff1e8f commit 13c1c46

File tree

1 file changed

+15
-20
lines changed
  • content/en/docs/concepts/configuration

1 file changed

+15
-20
lines changed

content/en/docs/concepts/configuration/secret.md

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -278,21 +278,15 @@ for information on referencing ServiceAccount credentials from within Pods.
278278
If you are creating a Secret to store credentials for accessing a container image registry,
279279
you must use one of the following `type` values for that Secret:
280280

281-
- `kubernetes.io/dockercfg`
282-
- `kubernetes.io/dockerconfigjson`
283-
284-
The `kubernetes.io/dockercfg` type is reserved to store a serialized
285-
`~/.dockercfg` which is the legacy format for configuring Docker command line.
286-
When using this Secret type, you have to ensure the Secret `data` field
287-
contains a `.dockercfg` key whose value is content of a `~/.dockercfg` file
288-
encoded in the base64 format.
289-
290-
The `kubernetes.io/dockerconfigjson` type is designed for storing a serialized
291-
JSON that follows the same format rules as the `~/.docker/config.json` file
292-
which is a new format for `~/.dockercfg`.
293-
When using this Secret type, the `data` field of the Secret object must
294-
contain a `.dockerconfigjson` key, in which the content for the
295-
`~/.docker/config.json` file is provided as a base64 encoded string.
281+
- `kubernetes.io/dockercfg`: store a serialized `~/.dockercfg` which is the
282+
legacy format for configuring Docker command line. The Secret
283+
`data` field contains a `.dockercfg` key whose value is the content of a
284+
base64 encoded `~/.dockercfg` file.
285+
- `kubernetes.io/dockerconfigjson`: store a serialized JSON that follows the
286+
same format rules as the `~/.docker/config.json` file, which is a new format
287+
for `~/.dockercfg`. The Secret `data` field must contain a
288+
`.dockerconfigjson` key for which the value is the content of a base64
289+
encoded `~/.docker/config.json` file.
296290

297291
Below is an example for a `kubernetes.io/dockercfg` type of Secret:
298292

@@ -312,7 +306,7 @@ If you do not want to perform the base64 encoding, you can choose to use the
312306
`stringData` field instead.
313307
{{< /note >}}
314308

315-
When you create these types of Secrets using a manifest, the API
309+
When you create Docker config Secrets using a manifest, the API
316310
server checks whether the expected key exists in the `data` field, and
317311
it verifies if the value provided can be parsed as a valid JSON. The API
318312
server doesn't validate if the JSON actually is a Docker config file.
@@ -328,15 +322,16 @@ kubectl create secret docker-registry secret-tiger-docker \
328322
--docker-server=my-registry.example:5000
329323
```
330324

331-
That command creates a Secret of type `kubernetes.io/dockerconfigjson`.
332-
If you dump the `.data.dockerconfigjson` field from that new Secret and then
333-
decode it from base64:
325+
This command creates a Secret of type `kubernetes.io/dockerconfigjson`.
326+
327+
Retrieve the `.data.dockerconfigjson` field from that new Secret and decode the
328+
data:
334329

335330
```shell
336331
kubectl get secret secret-tiger-docker -o jsonpath='{.data.*}' | base64 -d
337332
```
338333

339-
then the output is equivalent to this JSON document (which is also a valid
334+
The output is equivalent to the following JSON document (which is also a valid
340335
Docker configuration file):
341336

342337
```json

0 commit comments

Comments
 (0)