@@ -559,6 +559,50 @@ For example, `kubectl get configmaps --field-selector=metadata.name=my-configmap
559
559
例如,`kubectl get configmaps --field-selector=metadata.name=my-configmap`
560
560
{{< /note >}}
561
561
562
+ <!--
563
+ Rather than referring to individual `resources` and `verbs`
564
+ you can use the wildcard `*` symbol to refer to all such objects.
565
+ For `nonResourceURLs` you can use the wildcard `*` symbol as a suffix glob match and
566
+ for `apiGroups` and `resourceNames` an empty set means that everything is allowed.
567
+ Here is an example that allows access to perform any current and future action on
568
+ all current and future resources (note, this is similar to the built-in `cluster-admin` role).
569
+ -->
570
+ 使用通配符 `*` 可以批量引用所有的 `resources` 和 `verbs` 对象,无需逐一引用。
571
+ 对于 `nonResourceURLs`,可以将通配符 `*` 作为后缀实现全局通配,
572
+ 对于 `apiGroups` 和 `resourceNames`,空集表示没有任何限制。
573
+ 下面的示例允许对所有当前和未来资源执行所有动作(注意,这类似于内置的 `cluster-admin`)。
574
+
575
+ ` ` ` yaml
576
+ apiVersion: rbac.authorization.k8s.io/v1
577
+ kind: Role
578
+ metadata:
579
+ namespace: default
580
+ name: example.com-superuser # 此角色仅作示范,请勿使用
581
+ rules:
582
+ - apiGroups: ["example.com"]
583
+ resources: ["*"]
584
+ verbs: ["*"]
585
+ ` ` `
586
+
587
+ {{< caution >}}
588
+ <!--
589
+ Using wildcards in resource and verb entries could result in
590
+ overly permissive access being granted to sensitive resources.
591
+ For instance, if a new resource type is added, or a new subresource is added,
592
+ or a new custom verb is checked, the wildcard entry automatically grants access,
593
+ which may be undesirable.
594
+ The [principle of least privilege](/docs/concepts/security/rbac-good-practices/#least-privilege)
595
+ should be employed, using specific resources and verbs to ensure
596
+ only the permissions required for the workload to function correctly are applied.
597
+ -->
598
+ 在 resources 和 verbs 条目中使用通配符会为敏感资源授予过多的访问权限。
599
+ 例如,如果添加了新的资源类型、新的子资源或新的自定义动词,
600
+ 通配符条目会自动授予访问权限,用户可能不希望出现这种情况。
601
+ 应该执行[最小特权原则](zh-cn/docs/concepts/security/rbac-good-practices/#least-privilege),
602
+ 使用具体的 resources 和 verbs 确保仅赋予工作负载正常运行所需的权限。
603
+ {{< /caution >}}
604
+
605
+
562
606
<!--
563
607
# ## Aggregated ClusterRoles
564
608
@@ -2331,7 +2375,7 @@ This is not a recommended policy.
2331
2375
-->
2332
2376
下面的策略允许 **所有** 服务帐户充当集群管理员。
2333
2377
容器中运行的所有应用程序都会自动收到服务帐户的凭据,可以对 API 执行任何操作,
2334
- 包括查看 Secrets 和修改权限。这一策略是不被推荐的。
2378
+ 包括查看 Secret 和修改权限。这一策略是不被推荐的。
2335
2379
2336
2380
` ` ` shell
2337
2381
kubectl create clusterrolebinding permissive-binding \
0 commit comments