这是本节的多页打印视图。 点击此处打印.

返回本页常规视图.

身份认证资源

1 - ServiceAccount

ServiceAccount 将以下内容绑定在一起:1. 用户可以理解的名称,也可能是外围系统理解的身份标识 2. 可以验证和授权的主体 3. 一组 secret 。

apiVersion: v1

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

ServiceAccount

ServiceAccount 将以下内容绑定在一起:

  • 用户可以理解的名称,也可能是外围系统理解的身份标识
  • 可以验证和授权的主体
  • 一组 secret

  • apiVersion: v1

  • kind: ServiceAccount

  • metadata (ObjectMeta)

    标准对象的元数据,更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata

  • automountServiceAccountToken (boolean)

    AutomountServiceAccountToken 指示作为此服务帐户运行的 pod 是否应自动挂载 API 令牌, 可以在 pod 级别覆盖。

  • imagePullSecrets ([]LocalObjectReference)

    imagePullSecrets 是对同一命名空间中 Secret 的引用列表,用于拉取引用此 ServiceAccount 的 Pod 中的任何镜像。 imagePullSecrets 与 Secrets 不同,因为 Secrets 可以挂载在 Pod 中,但 imagePullSecrets 只能由 kubelet 访问。 更多信息:https://kubernetes.io/zh/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod

  • secrets ([]ObjectReference)

    补丁策略:基于键 name 合并 Secrets 是允许使用此 ServiceAccount 运行的 Pod 使用的 Secret 列表。 更多信息:https://kubernetes.io/zh/docs/concepts/configuration/secret

ServiceAccountList

ServiceAccountList 是 ServiceAccount 对象的列表


  • apiVersion: v1

  • kind: ServiceAccountList

  • metadata (ListMeta)

    标准列表元数据, 更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds

  • items ([]ServiceAccount), 必需

    ServiceAccount 列表,更多信息:https://kubernetes.io/zh/docs/tasks/configure-pod-container/configure-service-account/

操作


get 读取指定的 ServiceAccount

HTTP 请求

GET /api/v1/namespaces/{namespace}/serviceaccounts/{name}

参数

  • name (位于路径中): string, 必需

    ServiceAccount 的名称

  • namespace (位于路径中): string, 必需

    namespace

  • pretty (查询字符串): string

    pretty

响应

200 (ServiceAccount): OK

401: Unauthorized

list 列出或监控 ServiceAccount 类型的对象

HTTP 请求

GET /api/v1/namespaces/{namespace}/serviceaccounts

参数

  • namespace (位于路径中): string, 必需

    namespace

  • continue (查询字符串): string

    continue

  • limit (查询字符串): integer

    limit

  • pretty (查询字符串): string

    pretty

  • watch (查询字符串): boolean

    watch

响应

200 (ServiceAccountList): OK

401: Unauthorized

list 列出或监控 ServiceAccount 类型的对象

HTTP 请求

GET /api/v1/serviceaccounts

参数

  • continue (查询字符串): string

    continue

  • limit (查询字符串): integer

    limit

  • pretty (查询字符串): string

    pretty

  • watch (查询字符串): boolean

    watch

响应

200 (ServiceAccountList): OK

401: Unauthorized

create 创建一个 ServiceAccount

HTTP 请求

POST /api/v1/namespaces/{namespace}/serviceaccounts

参数

  • namespace (位于路径中): string, 必需

    namespace

  • dryRun (查询字符串): string

    dryRun

  • pretty (查询字符串): string

    pretty

响应

200 (ServiceAccount): OK

201 (ServiceAccount): Created

202 (ServiceAccount): Accepted

401: Unauthorized

update 替换指定的ServiceAccount

HTTP 请求

PUT /api/v1/namespaces/{namespace}/serviceaccounts/{name}

参数

  • name (位于路径中): string, required

    name of the ServiceAccount

  • namespace (位于路径中): string, 必需

    namespace

  • dryRun (查询字符串): string

    dryRun

  • pretty (查询字符串): string

    pretty

响应

200 (ServiceAccount): OK

201 (ServiceAccount): Created

401: Unauthorized

patch 部分更新指定的 ServiceAccount

HTTP 请求

PATCH /api/v1/namespaces/{namespace}/serviceaccounts/{name}

参数

  • name (位于路径中): string, 必需

    ServiceAccount 的名称

  • namespace (位于路径中): string, 必需

    namespace

  • body: Patch, required

  • dryRun (查询字符串): string

    dryRun

  • force (查询字符串): boolean

    force

  • pretty (查询字符串): string

    pretty

响应

200 (ServiceAccount): OK

201 (ServiceAccount): Created

401: Unauthorized

delete 删除一个 ServiceAccount

HTTP 请求

DELETE /api/v1/namespaces/{namespace}/serviceaccounts/{name}

参数

  • name (位于路径中): string, 必需

    ServiceAccount 的名称

  • dryRun (查询字符串): string

    dryRun

响应

200 (ServiceAccount): OK

202 (ServiceAccount): Accepted

401: Unauthorized

deletecollection 删除 ServiceAccount 的集合

HTTP 请求

DELETE /api/v1/namespaces/{namespace}/serviceaccounts

参数

  • continue (查询字符串): string

    continue

  • dryRun (查询字符串): string

    dryRun

  • limit (查询字符串): integer

    limit

  • pretty (查询字符串): string

    pretty

响应

200 (Status): OK

401: Unauthorized

2 - TokenReview

TokenReview 尝试通过验证令牌来确认已知用户。

apiVersion: authentication.k8s.io/v1

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

TokenReview

TokenReview 尝试通过验证令牌来确认已知用户。 注意:TokenReview 请求可能会被 kube-apiserver 中的 webhook 令牌验证器插件缓存。


  • apiVersion: authentication.k8s.io/v1

  • kind: TokenReview

  • metadata (ObjectMeta)

    标准对象的元数据,更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata

  • spec (TokenReviewSpec), required

    spec 保存有关正在评估的请求的信息

  • status (TokenReviewStatus)

    status 由服务器填写,指示请求是否可以通过身份验证。

TokenReviewSpec

TokenReviewPec 是对令牌身份验证请求的描述。


  • audiences ([]string)

    audiences 是带有令牌的资源服务器标识为受众的标识符列表。 受众感知令牌身份验证器将验证令牌是否适用于此列表中的至少一个受众。 如果未提供受众,受众将默认为 Kubernetes API 服务器的受众。

  • token (string)

    token 是不透明的持有者令牌(Bearer Token)。

TokenReviewStatus

TokenReviewStatus 是令牌认证请求的结果。


  • audiences ([]string)

    audiences 是身份验证者选择的与 TokenReview 和令牌兼容的受众标识符。 标识符是 TokenReviewSpec 受众和令牌受众的交集中的任何标识符。 设置 spec.audiences 字段的 TokenReview API 的客户端应验证在 status.audiences 字段中返回了兼容的受众标识符, 以确保 TokenReview 服务器能够识别受众。 如果 TokenReview 返回一个空的 status.audience 字段,其中 status.authenticated 为 “true”, 则该令牌对 Kubernetes API 服务器的受众有效。

  • authenticated (boolean)

    authenticated 表示令牌与已知用户相关联。

  • error (string)

    error 表示无法检查令牌

  • user (UserInfo)

    user 是与提供的令牌关联的 UserInfo。

    <-- UserInfo holds the information about the user needed to implement the user.Info interface. --> UserInfo 保存实现 user.Info 接口所需的用户信息

    • user.extra (map[string][]string)

    验证者提供的任何附加信息。

    • user.groups ([]string)

    此用户所属的组的名称。

    • user.uid (string)

    跨时间标识此用户的唯一值。如果删除此用户并添加另一个同名用户,他们将拥有不同的 UID。

    • user.username (string)

    在所有活动用户中唯一标识此用户的名称。

操作


create 创建一个TokenReview

HTTP 请求

POST /apis/authentication.k8s.io/v1/tokenreviews

参数

响应

200 (TokenReview): OK

201 (TokenReview): Created

202 (TokenReview): Accepted

401: Unauthorized