Merge pull request #48771 from ritazh/deprecate-EnforceMountableSecretsAnnotation

Add deprecation warnings for enforce-mountable-secrets annotation
pull/48856/head
Kubernetes Prow Robot 2024-11-26 17:12:56 +00:00 committed by GitHub
commit 01eccc6441
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 14 deletions

View File

@ -666,10 +666,7 @@ Therefore, one Pod does not have access to the Secrets of another Pod.
### Configure least-privilege access to Secrets ### Configure least-privilege access to Secrets
To enhance the security measures around Secrets, Kubernetes provides a mechanism: you can To enhance the security measures around Secrets, use separate namespaces to isolate access to mounted secrets.
annotate a ServiceAccount as `kubernetes.io/enforce-mountable-secrets: "true"`.
For more information, you can refer to the [documentation about this annotation](/docs/concepts/security/service-accounts/#enforce-mountable-secrets).
{{< warning >}} {{< warning >}}
Any containers that run with `privileged: true` on a node can access all Any containers that run with `privileged: true` on a node can access all

View File

@ -62,11 +62,8 @@ recommendations include:
* Implement audit rules that alert on specific events, such as concurrent * Implement audit rules that alert on specific events, such as concurrent
reading of multiple Secrets by a single user reading of multiple Secrets by a single user
#### Additional ServiceAccount annotations for Secret management #### Restrict Access for Secrets
Use separate namespaces to isolate access to mounted secrets.
You can also use the `kubernetes.io/enforce-mountable-secrets` annotation on
a ServiceAccount to enforce specific rules on how Secrets are used in a Pod.
For more details, see the [documentation on this annotation](/docs/reference/labels-annotations-taints/#enforce-mountable-secrets).
### Improve etcd management policies ### Improve etcd management policies

View File

@ -197,7 +197,13 @@ or using a custom mechanism such as an [authentication webhook](/docs/reference/
You can also use TokenRequest to obtain short-lived tokens for your external application. You can also use TokenRequest to obtain short-lived tokens for your external application.
{{< /note >}} {{< /note >}}
### Restricting access to Secrets {#enforce-mountable-secrets} ### Restricting access to Secrets (deprecated) {#enforce-mountable-secrets}
{{< feature-state for_k8s_version="v1.32" state="deprecated" >}}
{{< note >}}
`kubernetes.io/enforce-mountable-secrets` is deprecated since Kubernetes v1.32. Use separate namespaces to isolate access to mounted secrets.
{{< /note >}}
Kubernetes provides an annotation called `kubernetes.io/enforce-mountable-secrets` Kubernetes provides an annotation called `kubernetes.io/enforce-mountable-secrets`
that you can add to your ServiceAccounts. When this annotation is applied, that you can add to your ServiceAccounts. When this annotation is applied,

View File

@ -785,9 +785,7 @@ The Kubernetes project strongly recommends enabling this admission controller.
You should enable this admission controller if you intend to make any use of Kubernetes You should enable this admission controller if you intend to make any use of Kubernetes
`ServiceAccount` objects. `ServiceAccount` objects.
Regarding the annotation `kubernetes.io/enforce-mountable-secrets`: While the annotation's name suggests it only concerns the mounting of Secrets, To enhance the security measures around Secrets, use separate namespaces to isolate access to mounted secrets.
its enforcement also extends to other ways Secrets are used in the context of a Pod.
Therefore, it is crucial to ensure that all the referenced secrets are correctly specified in the ServiceAccount.
### StorageObjectInUseProtection ### StorageObjectInUseProtection

View File

@ -804,7 +804,7 @@ Used on: All Objects
This annotation is used for describing specific behaviour of given object. This annotation is used for describing specific behaviour of given object.
### kubernetes.io/enforce-mountable-secrets {#enforce-mountable-secrets} ### kubernetes.io/enforce-mountable-secrets (deprecated) {#enforce-mountable-secrets}
Type: Annotation Type: Annotation
@ -812,6 +812,10 @@ Example: `kubernetes.io/enforce-mountable-secrets: "true"`
Used on: ServiceAccount Used on: ServiceAccount
{{< note >}}
`kubernetes.io/enforce-mountable-secrets` is deprecated since Kubernetes v1.32. Use separate namespaces to isolate access to mounted secrets.
{{< /note >}}
The value for this annotation must be **true** to take effect. The value for this annotation must be **true** to take effect.
When you set this annotation to "true", Kubernetes enforces the following rules for When you set this annotation to "true", Kubernetes enforces the following rules for
Pods running as this ServiceAccount: Pods running as this ServiceAccount: