You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
59
-
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.
60
-
58
+
Kubernetes Secrets are, by default, stored unencrypted in the API server's underlying data store
59
+
(etcd). Anyone with API access can retrieve or modify a Secret, and so can anyone with access to etcd.
60
+
Additionally, anyone who is authorized to create a Pod in a namespace can use that access to read
61
+
any Secret in that namespace; this includes indirect access such as the ability to create a
62
+
Deployment.
61
63
In order to safely use Secrets, take at least the following steps:
62
64
63
65
1. [Enable Encryption at Rest](/docs/tasks/administer-cluster/encrypt-data/) for Secrets.
64
-
1. [Enable or configure RBAC rules](/docs/reference/access-authn-authz/authorization/) with least-privilege access to Secrets.
66
+
1. [Enable or configure RBAC rules](/docs/reference/access-authn-authz/authorization/) with
67
+
least-privilege access to Secrets.
65
68
1. Restrict Secret access to specific containers.
66
69
1. [Consider using external Secret store providers](https://secrets-store-csi-driver.sigs.k8s.io/concepts.html#provider-for-the-secrets-store-csi-driver).
67
70
-->
@@ -377,10 +380,14 @@ To configure that, you:
377
380
378
381
<!--
379
382
1. Create a secret or use an existing one. Multiple Pods can reference the same secret.
380
-
1. Modify your Pod definition to add a volume under `.spec.volumes[]`. Name the volume anything, and have a `.spec.volumes[].secret.secretName` field equal to the name of the Secret object.
381
-
1. Add a `.spec.containers[].volumeMounts[]` to each container that needs the secret. Specify `.spec.containers[].volumeMounts[].readOnly = true` and `.spec.containers[].volumeMounts[].mountPath` to an unused directory name where you would like the secrets to appear.
382
-
1. Modify your image or command line so that the program looks for files in that directory. Each key in the secret `data` map becomes the filename under `mountPath`.
383
-
383
+
1. Modify your Pod definition to add a volume under `.spec.volumes[]`. Name the volume anything,
384
+
and have a `.spec.volumes[].secret.secretName` field equal to the name of the Secret object.
385
+
1. Add a `.spec.containers[].volumeMounts[]` to each container that needs the secret. Specify
`.spec.containers[].volumeMounts[].mountPath`to an unused directory name where you would like the
388
+
secrets to appear.
389
+
1. Modify your image or command line so that the program looks for files in that directory. Each
390
+
key in the secret `data` map becomes the filename under `mountPath`.
384
391
This is an example of a Pod that mounts a Secret named `mysecret` in a volume:
385
392
-->
386
393
1. 创建一个 Secret 或者使用已有的 Secret。多个 Pod 可以引用同一个 Secret。
@@ -658,8 +665,10 @@ automated Secret updates.
658
665
<!--
659
666
The kubelet keeps a cache of the current keys and values for the Secrets that are used in
660
667
volumes for pods on that node.
661
-
You can configure the way that the kubelet detects changes from the cached values. The `configMapAndSecretChangeDetectionStrategy` field in
662
-
the [kubelet configuration](/docs/reference/config-api/kubelet-config.v1beta1/) controls which strategy the kubelet uses. The default strategy is `Watch`.
668
+
You can configure the way that the kubelet detects changes from the cached values. The
669
+
`configMapAndSecretChangeDetectionStrategy` field in the
##### Arranging for imagePullSecrets to be automatically attached
897
907
898
-
You can manually create `imagePullSecrets`, and reference these from
899
-
a ServiceAccount. Any Pods created with that ServiceAccount
900
-
or created with that ServiceAccount by default, will get their `imagePullSecrets`
901
-
field set to that of the service account.
908
+
You can manually create `imagePullSecrets`, and reference these from a ServiceAccount. Any Pods
909
+
created with that ServiceAccount or created with that ServiceAccount by default, will get their
910
+
`imagePullSecrets` field set to that of the service account.
902
911
See [Add ImagePullSecrets to a service account](/docs/tasks/configure-pod-container/configure-service-account/#add-imagepullsecrets-to-a-service-account)
Use `envFrom` to define all of the Secret's data as container environment variables. The key from the Secret becomes the environment variable name in the Pod.
966
+
Use `envFrom` to define all of the Secret's data as container environment variables. The key from
967
+
the Secret becomes the environment variable name in the Pod.
959
968
-->
960
969
使用 `envFrom` 来将 Secret 的所有数据定义为容器的环境变量。
961
970
来自 Secret 的主键成为 Pod 中的环境变量名称:
@@ -1065,9 +1074,8 @@ The container is then free to use the secret data to establish an SSH connection
1065
1074
<!--
1066
1075
### Use case: Pods with prod / test credentials
1067
1076
1068
-
This example illustrates a Pod which consumes a secret containing production
1069
-
credentials and another Pod which consumes a secret with test environment
1070
-
credentials.
1077
+
This example illustrates a Pod which consumes a secret containing production credentials and
1078
+
another Pod which consumes a secret with test environment credentials.
1071
1079
1072
1080
You can create a `kustomization.yaml` with a `secretGenerator` field or run
1073
1081
`kubectl create secret`.
@@ -1113,7 +1121,8 @@ secret "test-db-secret" created
1113
1121
1114
1122
{{< note >}}
1115
1123
<!--
1116
-
Special characters such as `$`, `\`, `*`, `=`, and `!` will be interpreted by your [shell](https://en.wikipedia.org/wiki/Shell_(computing)) and require escaping.
1124
+
Special characters such as `$`, `\`, `*`, `=`, and `!` will be interpreted by your
1125
+
[shell](https://en.wikipedia.org/wiki/Shell_(computing)) and require escaping.
0 commit comments