ClusterRole

ClusterRole 是一个集群级别的逻辑 PolicyRule 分组,可以作为 RoleBinding 或 ClusterRoleBinding 的单元进行引用。

apiVersion: rbac.authorization.k8s.io/v1

import "k8s.io/api/rbac/v1"

ClusterRole

ClusterRole 是一个集群级别的逻辑 PolicyRule 分组,可以作为 RoleBinding 或 ClusterRoleBinding 的单元进行引用。


  • apiVersion: rbac.authorization.k8s.io/v1

  • kind: ClusterRole

  • metadata (ObjectMeta)

    标准对象的元数据。

  • aggregationRule (AggregationRule)

    AggregationRule 是一个可选字段,描述如何为此 ClusterRole 构建规则。如果设置了 AggregationRule,则规则由控制器管理,对规则的直接更改将被控制器覆盖。

    AggregationRule 描述如何查找要聚合到 ClusterRole 中的 ClusterRole

    • aggregationRule.clusterRoleSelectors ([]LabelSelector)

      原子性:在合并期间将被替换

      ClusterRoleSelectors 包含一个选择器列表,这些选择器将用于查找 ClusterRole 并创建规则。如果任何选择器匹配,则将添加 ClusterRole 的权限

  • rules ([]PolicyRule)

    原子性:在合并期间将被替换

    规则包含此 ClusterRole 的所有 PolicyRule

    PolicyRule 包含描述策略规则的信息,但不包含有关该规则适用于谁或该规则适用于哪个命名空间的信息。

    • rules.apiGroups ([]string)

      原子性:在合并期间将被替换

      APIGroups 是包含资源的 APIGroup 的名称。如果指定了多个 API 组,则允许针对任何 API 组中枚举的资源请求的任何操作。“”表示核心 API 组,“*”表示所有 API 组。

    • rules.resources ([]string)

      原子性:在合并期间将被替换

      资源是此规则适用的资源列表。“*”表示所有资源。

    • rules.verbs ([]string),必需

      原子性:在合并期间将被替换

      Verbs 是适用于此规则中包含的所有 ResourceKinds 的 Verbs 列表。“*”表示所有动词。

    • rules.resourceNames ([]string)

      原子性:在合并期间将被替换

      ResourceNames 是该规则适用的名称的可选白名单。空集表示允许所有内容。

    • rules.nonResourceURLs ([]string)

      原子性:在合并期间将被替换

      NonResourceURLs 是一组用户应该有权访问的部分 URL。“*”是允许的,但仅作为路径中的完整、最后一步。由于非资源 URL 没有命名空间,因此此字段仅适用于从 ClusterRoleBinding 引用的 ClusterRole。规则可以应用于 API 资源(例如“pods”或“secrets”)或非资源 URL 路径(例如“/api”),但不能同时应用于两者。

ClusterRoleList

ClusterRoleList 是 ClusterRole 的集合


  • apiVersion: rbac.authorization.k8s.io/v1

  • kind: ClusterRoleList

  • metadata (ListMeta)

    标准对象的元数据。

  • items ([]ClusterRole),必需

    Items 是 ClusterRole 的列表

操作


get 读取指定的 ClusterRole

HTTP 请求

GET /apis/rbac.authorization.k8s.io/v1/clusterroles/{name}

参数

  • name (在路径中): 字符串,必需

    ClusterRole 的名称

  • pretty (在查询中): 字符串

    pretty

响应

200 (ClusterRole): 确定

401: 未授权

list 列出或监视 ClusterRole 类型的对象

HTTP 请求

GET /apis/rbac.authorization.k8s.io/v1/clusterroles

参数

响应

200 (ClusterRoleList): 确定

401: 未授权

create 创建 ClusterRole

HTTP 请求

POST /apis/rbac.authorization.k8s.io/v1/clusterroles

参数

响应

200 (ClusterRole): 确定

201 (ClusterRole): 已创建

202 (ClusterRole): 已接受

401: 未授权

update 替换指定的 ClusterRole

HTTP 请求

PUT /apis/rbac.authorization.k8s.io/v1/clusterroles/{name}

参数

  • name (在路径中): 字符串,必需

    ClusterRole 的名称

  • body: ClusterRole,必需

  • dryRun (在查询中): 字符串

    dryRun

  • fieldManager (在查询中): 字符串

    字段管理器

  • fieldValidation (在查询中): 字符串

    字段验证

  • pretty (在查询中): 字符串

    pretty

响应

200 (ClusterRole): 确定

201 (ClusterRole): 已创建

401: 未授权

patch 部分更新指定的 ClusterRole

HTTP 请求

PATCH /apis/rbac.authorization.k8s.io/v1/clusterroles/{name}

参数

  • name (在路径中): 字符串,必需

    ClusterRole 的名称

  • body: Patch,必需

  • dryRun (在查询中): 字符串

    dryRun

  • fieldManager (在查询中): 字符串

    字段管理器

  • fieldValidation (在查询中): 字符串

    字段验证

  • force (在查询中): 布尔值

    强制

  • pretty (在查询中): 字符串

    pretty

响应

200 (ClusterRole): 确定

201 (ClusterRole): 已创建

401: 未授权

delete 删除 ClusterRole

HTTP 请求

DELETE /apis/rbac.authorization.k8s.io/v1/clusterroles/{name}

参数

  • name (在路径中): 字符串,必需

    ClusterRole 的名称

  • body: DeleteOptions

  • dryRun (在查询中): 字符串

    dryRun

  • gracePeriodSeconds (在查询中): 整数

    宽限期秒数

  • pretty (在查询中): 字符串

    pretty

  • propagationPolicy (在查询中): 字符串

    传播策略

响应

200 (Status): 确定

202 (Status): 已接受

401: 未授权

deletecollection 删除 ClusterRole 的集合

HTTP 请求

DELETE /apis/rbac.authorization.k8s.io/v1/clusterroles

参数

响应

200 (Status): 确定

401: 未授权

此页面是自动生成的。

如果您计划报告此页面的问题,请在您的问题描述中提及该页面是自动生成的。修复可能需要在 Kubernetes 项目的其他地方进行。

上次修改时间为 2024 年 8 月 28 日下午 6:01 PST:更新 v1.31 的生成的 API 参考 (8ba98c79c1)