Merge pull request #36043 from tomkivlin/tomkivlin/issue28580

Mention wildcard for RBAC resources and names
This commit is contained in:
Kubernetes Prow Robot 2022-09-07 09:24:37 -07:00 committed by GitHub
commit e8b9538785
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 0 deletions

View File

@ -285,6 +285,28 @@ If you restrict `list` or `watch` by resourceName, clients must include a `metad
For example, `kubectl get configmaps --field-selector=metadata.name=my-configmap` For example, `kubectl get configmaps --field-selector=metadata.name=my-configmap`
{{< /note >}} {{< /note >}}
Rather than referring to individual `resources` and `verbs` you can use the wildcard `*` symbol to refer to all such objects.
For `nonResourceURLs` you can use the wildcard `*` symbol as a suffix glob match and for `apiGroups` and `resourceNames` an empty set means that everything is allowed.
Here is an example that allows access to perform any current and future action on all current and future resources (note, this is similar to the built-in `cluster-admin` role).
```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: default
name: example.com-superuser # DO NOT USE THIS ROLE, IT IS JUST AN EXAMPLE
rules:
- apiGroups: ["example.com"]
resources: ["*"]
verbs: ["*"]
```
{{< caution >}}
Using wildcards in resource and verb entries could result in overly permissive access being granted to sensitive resources.
For instance, if a new resource type is added, or a new subresource is added, or a new custom verb is checked, the wildcard entry automatically grants access, which may be undesirable.
The [principle of least privilege](/docs/concepts/security/rbac-good-practices/#least-privilege) should be employed, using specific resources and verbs to ensure only the permissions required for the workload to function correctly are applied.
{{< /caution >}}
### Aggregated ClusterRoles ### Aggregated ClusterRoles