Skip to content

Commit 0f8a345

Browse files
authored
Merge pull request #27716 from sftim/20210425_revise_secret_concept
Revise wording for Secret concept
2 parents 0b0b85b + 7a8389c commit 0f8a345

File tree

1 file changed

+32
-23
lines changed
  • content/en/docs/concepts/configuration

1 file changed

+32
-23
lines changed

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

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,33 @@ weight: 30
1212

1313
<!-- overview -->
1414

15-
Kubernetes Secrets let you store and manage sensitive information, such
16-
as passwords, OAuth tokens, and ssh keys. Storing confidential information in a Secret
17-
is safer and more flexible than putting it verbatim in a
18-
{{< glossary_tooltip term_id="pod" >}} definition or in a
19-
{{< glossary_tooltip text="container image" term_id="image" >}}.
20-
See [Secrets design document](https://git.k8s.io/community/contributors/design-proposals/auth/secrets.md) for more information.
21-
2215
A Secret is an object that contains a small amount of sensitive data such as
2316
a password, a token, or a key. Such information might otherwise be put in a
24-
Pod specification or in an image. Users can create Secrets and the system
25-
also creates some Secrets.
17+
{{< glossary_tooltip term_id="pod" >}} specification or in a
18+
{{< glossary_tooltip text="container image" term_id="image" >}}. Using a
19+
Secret means that you don't need to include confidential data in your
20+
application code.
21+
22+
Because Secrets can be created independently of the Pods that use them, there
23+
is less risk of the Secret (and its data) being exposed during the workflow of
24+
creating, viewing, and editing Pods. Kubernetes, and applications that run in
25+
your cluster, can also take additional precautions with Secrets, such as
26+
avoiding writing confidential data to nonvolatile storage.
27+
28+
Secrets are similar to {{< glossary_tooltip text="ConfigMaps" term_id="configmap" >}}
29+
but are specifically intended to hold confidential data.
2630

2731
{{< caution >}}
28-
Kubernetes Secrets are, by default, stored as unencrypted base64-encoded
29-
strings. By default they can be retrieved - as plain text - by anyone with API
30-
access, or anyone with access to Kubernetes' underlying data store, etcd. In
31-
order to safely use Secrets, it is recommended you (at a minimum):
32+
Kubernetes Secrets are, by default, stored unencrypted in the API server's underlying data store (etcd). Anyone with API access can retrieve or modify a Secret, and so can anyone with access to etcd.
33+
Additionally, anyone who is authorized to create a Pod in a namespace can use that access to read any Secret in that namespace; this includes indirect access such as the ability to create a Deployment.
34+
35+
In order to safely use Secrets, take at least the following steps:
3236

3337
1. [Enable Encryption at Rest](/docs/tasks/administer-cluster/encrypt-data/) for Secrets.
34-
2. [Enable or configure RBAC rules](/docs/reference/access-authn-authz/authorization/) that restrict reading and writing the Secret. Be aware that secrets can be obtained implicitly by anyone with the permission to create a Pod.
38+
2. Enable or configure [RBAC rules](/docs/reference/access-authn-authz/authorization/) that
39+
restrict reading data in Secrets (including via indirect means).
40+
3. Where appropriate, also use mechanisms such as RBAC to limit which principals are allowed to create new Secrets or replace existing ones.
41+
3542
{{< /caution >}}
3643

3744
<!-- body -->
@@ -47,6 +54,10 @@ A Secret can be used with a Pod in three ways:
4754
- As [container environment variable](#using-secrets-as-environment-variables).
4855
- By the [kubelet when pulling images](#using-imagepullsecrets) for the Pod.
4956

57+
The Kubernetes control plane also uses Secrets; for example,
58+
[bootstrap token Secrets](#bootstrap-token-secrets) are a mechanism to
59+
help automate node registration.
60+
5061
The name of a Secret object must be a valid
5162
[DNS subdomain name](/docs/concepts/overview/working-with-objects/names#dns-subdomain-names).
5263
You can specify the `data` and/or the `stringData` field when creating a
@@ -407,9 +418,9 @@ stringData:
407418

408419
There are several options to create a Secret:
409420

410-
- [create Secrets using `kubectl` command](/docs/tasks/configmap-secret/managing-secret-using-kubectl/)
411-
- [create Secrets from config file](/docs/tasks/configmap-secret/managing-secret-using-config-file/)
412-
- [create Secrets using kustomize](/docs/tasks/configmap-secret/managing-secret-using-kustomize/)
421+
- [create Secret using `kubectl` command](/docs/tasks/configmap-secret/managing-secret-using-kubectl/)
422+
- [create Secret from config file](/docs/tasks/configmap-secret/managing-secret-using-config-file/)
423+
- [create Secret using kustomize](/docs/tasks/configmap-secret/managing-secret-using-kustomize/)
413424

414425
## Editing a Secret
415426

@@ -1164,7 +1175,7 @@ limit access using [authorization policies](
11641175
Secrets often hold values that span a spectrum of importance, many of which can
11651176
cause escalations within Kubernetes (e.g. service account tokens) and to
11661177
external systems. Even if an individual app can reason about the power of the
1167-
secrets it expects to interact with, other apps within the same namespace can
1178+
Secrets it expects to interact with, other apps within the same namespace can
11681179
render those assumptions invalid.
11691180

11701181
For these reasons `watch` and `list` requests for secrets within a namespace are
@@ -1236,10 +1247,8 @@ for secret data, so that the secrets are not stored in the clear into {{< glossa
12361247
if the API server policy does not allow that user to read the Secret, the user could
12371248
run a Pod which exposes the secret.
12381249

1239-
12401250
## {{% heading "whatsnext" %}}
12411251

1242-
- Learn how to [manage Secrets using `kubectl`](/docs/tasks/configmap-secret/managing-secret-using-kubectl/)
1243-
- Learn how to [manage Secrets using config file](/docs/tasks/configmap-secret/managing-secret-using-config-file/)
1244-
- Learn how to [manage Secrets using kustomize](/docs/tasks/configmap-secret/managing-secret-using-kustomize/)
1245-
1252+
- Learn how to [manage Secret using `kubectl`](/docs/tasks/configmap-secret/managing-secret-using-kubectl/)
1253+
- Learn how to [manage Secret using config file](/docs/tasks/configmap-secret/managing-secret-using-config-file/)
1254+
- Learn how to [manage Secret using kustomize](/docs/tasks/configmap-secret/managing-secret-using-kustomize/)

0 commit comments

Comments
 (0)