华为云UCS
华为云UCS
- 最新动态
- 服务公告
- 产品介绍
- 计费说明
- 快速入门
-
用户指南
- UCS集群
- 容器舰队
- 集群联邦
- 镜像仓库
- 权限管理
-
策略中心
- 策略中心概述
- 策略定义与策略实例的基本概念
- 启用策略中心
- 创建和管理策略实例
- 示例:使用策略中心实现Kubernetes资源合规性治理
-
使用策略定义库
- 策略定义库概述
- k8spspvolumetypes
- k8spspallowedusers
- k8spspselinuxv2
- k8spspseccomp
- k8spspreadonlyrootfilesystem
- k8spspprocmount
- k8spspprivilegedcontainer
- k8spsphostnetworkingports
- k8spsphostnamespace
- k8spsphostfilesystem
- k8spspfsgroup
- k8spspforbiddensysctls
- k8spspflexvolumes
- k8spspcapabilities
- k8spspapparmor
- k8spspallowprivilegeescalationcontainer
- k8srequiredprobes
- k8srequiredlabels
- k8srequiredannotations
- k8sreplicalimits
- noupdateserviceaccount
- k8simagedigests
- k8sexternalips
- k8sdisallowedtags
- k8sdisallowanonymous
- k8srequiredresources
- k8scontainerratios
- k8scontainerrequests
- k8scontainerlimits
- k8sblockwildcardingress
- k8sblocknodeport
- k8sblockloadbalancer
- k8sblockendpointeditdefaultrole
- k8spspautomountserviceaccounttokenpod
- k8sallowedrepos
- 配置管理
- 服务网格
- 流量分发
- 可观测性
- 云原生服务中心
- 容器迁移
- 流水线
- 错误码
- 最佳实践
- API参考
- 常见问题
- 文档下载
- 通用参考
本文导读
链接复制成功!
k8sblockendpointeditdefaultrole
基本信息
- 策略类型:合规
- 推荐级别:L1
- 生效资源类型:ClusterRole
- 参数:无
作用
默认情况下,许多Kubernetes都预定义了一个名为system:aggregate-to-edit的ClusterRole,k8sblockendpointeditdefaultrole策略定义禁止该ClusterRole对Endpoints进行create、patch和update操作。
策略实例示例
以下策略实例展示了策略定义生效的资源类型。
apiVersion: constraints.gatekeeper.sh/v1beta1 kind: K8sBlockEndpointEditDefaultRole metadata: name: block-endpoint-edit-default-role spec: match: kinds: - apiGroups: ["rbac.authorization.k8s.io"] kinds: ["ClusterRole"]
符合策略实例的资源定义
示例中ClusterRole的生效对象中没有endpoints,符合策略实例。
apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: annotations: rbac.authorization.kubernetes.io/autoupdate: "true" creationTimestamp: null labels: kubernetes.io/bootstrapping: rbac-defaults rbac.authorization.k8s.io/aggregate-to-edit: "true" name: system:aggregate-to-edit rules: - apiGroups: - "" resources: - pods/attach - pods/exec - secrets - services/proxy verbs: - get - list - watch
不符合策略实例的资源定义
示例中ClusterRole的生效对象中有endpoints,不符合策略实例。
kind: ClusterRole metadata: annotations: rbac.authorization.kubernetes.io/autoupdate: "true" creationTimestamp: null labels: kubernetes.io/bootstrapping: rbac-defaults rbac.authorization.k8s.io/aggregate-to-edit: "true" name: system:aggregate-to-edit rules: - apiGroups: - apps resources: - endpoints verbs: - create - delete - deletecollection - patch - update
父主题: 使用策略定义库