website/content/zh-cn/docs/reference/kubernetes-api/authorization-resources/cluster-role-binding-v1.md

24 KiB
Raw Blame History

api_metadata content_type description title weight auto_generated
apiVersion import kind
rbac.authorization.k8s.io/v1 k8s.io/api/rbac/v1 ClusterRoleBinding
api_reference ClusterRoleBinding 引用 ClusterRole但不包含它。 ClusterRoleBinding 6 false

apiVersion: rbac.authorization.k8s.io/v1

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

ClusterRoleBinding

ClusterRoleBinding 引用 ClusterRole但不包含它。 它可以引用全局命名空间中的 ClusterRole并通过 Subject 添加主体信息。


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

  • kind: ClusterRoleBinding

  • metadata (<a href="{{< ref "../common-definitions/object-meta#ObjectMeta" >}}">ObjectMeta)

    标准对象的元数据。

  • roleRef (RoleRef),必需

    RoleRef 只能引用全局命名空间中的 ClusterRole。 如果无法解析 RoleRef则 Authorizer 必定返回一个错误。这个字段是不可变的。

    RoleRef 包含指向正被使用的角色的信息。

    • roleRef.apiGroup (string),必需

      apiGroup 是被引用资源的组

    • roleRef.kind (string),必需

      kind 是被引用的资源的类别

    • roleRef.name (string),必需

      name 是被引用的资源的名称

  • subjects ([]Subject)

    Subjects 包含角色所适用的对象的引用。

    Subject 包含对角色绑定所适用的对象或用户标识的引用。其中可以包含直接 API 对象的引用或非对象(如用户名和组名)的值。

    • subjects.kind (string),必需

    被引用的对象的类别。这个 API 组定义的值是 UserGroupServiceAccount。 如果 Authorizer 无法识别类别值,则 Authorizer 应报告一个错误。

    • subjects.name (string),必需

      被引用的对象的名称。

    • subjects.apiGroup (string)

    apiGroup 包含被引用主体的 API 组。对于 ServiceAccount 主体默认为 ""。 对于 User 和 Group 主体,默认为 "rbac.authorization.k8s.io"。

    • subjects.namespace (string)

      被引用对象的命名空间。 如果对象类别是 "User" 或 "Group" 等非命名空间作用域的对象且该值不为空, 则 Authorizer 应报告一个错误。

ClusterRoleBindingList

ClusterRoleBindingList 是 ClusterRoleBinding 的集合。


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

  • kind: ClusterRoleBindingList

  • metadata (<a href="{{< ref "../common-definitions/list-meta#ListMeta" >}}">ListMeta)

    标准的对象元数据。

  • items ([]<a href="{{< ref "../authorization-resources/cluster-role-binding-v1#ClusterRoleBinding" >}}">ClusterRoleBinding),必需

    items 是 ClusterRoleBindings 的列表。

操作


get 读取指定的 ClusterRoleBinding

HTTP 请求

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

参数

  • name (路径参数): string必需

    ClusterRoleBinding 的名称

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../authorization-resources/cluster-role-binding-v1#ClusterRoleBinding" >}}">ClusterRoleBinding): OK

401: Unauthorized

list 列出或观测类别为 ClusterRoleBinding 的对象

HTTP 请求

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

参数

  • allowWatchBookmarks (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#allowWatchBookmarks" >}}">allowWatchBookmarks

  • continue (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#continue" >}}">continue

  • fieldSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldSelector" >}}">fieldSelector

  • labelSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#labelSelector" >}}">labelSelector

  • limit (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#limit" >}}">limit

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

  • resourceVersion (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersion" >}}">resourceVersion

  • resourceVersionMatch (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersionMatch" >}}">resourceVersionMatch

  • sendInitialEvents (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents

  • timeoutSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds

  • watch (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#watch" >}}">watch

响应

200 (<a href="{{< ref "../authorization-resources/cluster-role-binding-v1#ClusterRoleBindingList" >}}">ClusterRoleBindingList): OK

401: Unauthorized

create 创建 ClusterRoleBinding

HTTP 请求

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

参数

  • body: <a href="{{< ref "../authorization-resources/cluster-role-binding-v1#ClusterRoleBinding" >}}">ClusterRoleBinding必需
  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldManager (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager

  • fieldValidation (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../authorization-resources/cluster-role-binding-v1#ClusterRoleBinding" >}}">ClusterRoleBinding): OK

201 (<a href="{{< ref "../authorization-resources/cluster-role-binding-v1#ClusterRoleBinding" >}}">ClusterRoleBinding): Created

202 (<a href="{{< ref "../authorization-resources/cluster-role-binding-v1#ClusterRoleBinding" >}}">ClusterRoleBinding): Accepted

401: Unauthorized

update 替换指定的 ClusterRoleBinding

HTTP 请求

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

参数

  • name (路径参数): string必需

    ClusterRoleBinding 的名称

  • body: <a href="{{< ref "../authorization-resources/cluster-role-binding-v1#ClusterRoleBinding" >}}">ClusterRoleBinding必需

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldManager (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager

  • fieldValidation (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../authorization-resources/cluster-role-binding-v1#ClusterRoleBinding" >}}">ClusterRoleBinding): OK

201 (<a href="{{< ref "../authorization-resources/cluster-role-binding-v1#ClusterRoleBinding" >}}">ClusterRoleBinding): Created

401: Unauthorized

patch 部分更新指定的 ClusterRoleBinding

HTTP 请求

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

参数

  • name (路径参数): string必需

    ClusterRoleBinding 的名称

  • body: <a href="{{< ref "../common-definitions/patch#Patch" >}}">Patch必需

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldManager (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager

  • fieldValidation (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation

  • force (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#force" >}}">force

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../authorization-resources/cluster-role-binding-v1#ClusterRoleBinding" >}}">ClusterRoleBinding): OK

201 (<a href="{{< ref "../authorization-resources/cluster-role-binding-v1#ClusterRoleBinding" >}}">ClusterRoleBinding): Created

401: Unauthorized

delete 删除 ClusterRoleBinding

HTTP 请求

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

参数

  • name (路径参数): string必需

    ClusterRoleBinding 的名称

  • body: <a href="{{< ref "../common-definitions/delete-options#DeleteOptions" >}}">DeleteOptions

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • gracePeriodSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#gracePeriodSeconds" >}}">gracePeriodSeconds

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

  • propagationPolicy (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#propagationPolicy" >}}">propagationPolicy

响应

200 (<a href="{{< ref "../common-definitions/status#Status" >}}">Status): OK

202 (<a href="{{< ref "../common-definitions/status#Status" >}}">Status): Accepted

401: Unauthorized

deletecollection 删除 ClusterRoleBinding 的集合

HTTP 请求

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

参数

  • body: <a href="{{< ref "../common-definitions/delete-options#DeleteOptions" >}}">DeleteOptions

  • continue (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#continue" >}}">continue

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldSelector" >}}">fieldSelector

  • gracePeriodSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#gracePeriodSeconds" >}}">gracePeriodSeconds

  • labelSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#labelSelector" >}}">labelSelector

  • limit (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#limit" >}}">limit

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

  • propagationPolicy (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#propagationPolicy" >}}">propagationPolicy

  • resourceVersion (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersion" >}}">resourceVersion

  • resourceVersionMatch (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersionMatch" >}}">resourceVersionMatch

  • sendInitialEvents (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents

  • timeoutSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds

响应

200 (<a href="{{< ref "../common-definitions/status#Status" >}}">Status): OK

401: Unauthorized