ServiceAccount

ServiceAccount 将以下内容绑定在一起:* 一个名称,供用户理解,也可能供外围系统理解,用于标识 * 一个可以进行身份验证和授权的主体 * 一组密钥。

apiVersion: v1

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

ServiceAccount

ServiceAccount 将以下内容绑定在一起:* 一个名称,供用户理解,也可能供外围系统理解,用于标识 * 一个可以进行身份验证和授权的主体 * 一组密钥


  • apiVersion: v1

  • kind: ServiceAccount

  • metadata (ObjectMeta)

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

  • automountServiceAccountToken (boolean)

    AutomountServiceAccountToken 指示运行此 ServiceAccount 的 Pod 是否应自动挂载 API 令牌。可以在 Pod 级别覆盖此设置。

  • imagePullSecrets ([]LocalObjectReference)

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

    ImagePullSecrets 是一个列表,引用同一命名空间中的密钥,用于拉取引用此 ServiceAccount 的 Pod 中的任何镜像。ImagePullSecrets 与 Secrets 不同,因为 Secrets 可以挂载到 Pod 中,但 ImagePullSecrets 仅由 kubelet 访问。更多信息:https://kubernetes.ac.cn/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod

  • secrets ([]ObjectReference)

    补丁策略:在 key name 上合并

    映射:在合并期间将保留 key name 上的唯一值

    Secrets 是一个列表,其中包含使用此 ServiceAccount 运行的 Pod 允许使用的同一命名空间中的密钥。如果此 ServiceAccount 具有设置为“true”的“kubernetes.io/enforce-mountable-secrets”注释,则 Pod 仅限于此列表。 “kubernetes.io/enforce-mountable-secrets”注释自 v1.32 起已弃用。建议使用单独的命名空间来隔离对挂载密钥的访问。不应使用此字段来查找自动生成的 ServiceAccount 令牌密钥以在 Pod 外部使用。相反,可以使用 TokenRequest API 直接请求令牌,或者可以手动创建 ServiceAccount 令牌密钥。更多信息:https://kubernetes.ac.cn/docs/concepts/configuration/secret

ServiceAccountList

ServiceAccountList 是 ServiceAccount 对象的列表


操作


get 读取指定的 ServiceAccount

HTTP 请求

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

Parameters

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

    ServiceAccount 的名称

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

    命名空间

  • pretty (在查询中): string

    pretty

响应

200 (ServiceAccount): OK

401: 未授权

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

HTTP 请求

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

Parameters

响应

200 (ServiceAccountList): OK

401: 未授权

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

HTTP 请求

GET /api/v1/serviceaccounts

Parameters

响应

200 (ServiceAccountList): OK

401: 未授权

create 创建 ServiceAccount

HTTP 请求

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

Parameters

响应

200 (ServiceAccount): OK

201 (ServiceAccount): Created

202 (ServiceAccount): Accepted

401: 未授权

update 替换指定的 ServiceAccount

HTTP 请求

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

Parameters

响应

200 (ServiceAccount): OK

201 (ServiceAccount): Created

401: 未授权

patch 部分更新指定的 ServiceAccount

HTTP 请求

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

Parameters

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

    ServiceAccount 的名称

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

    命名空间

  • body: Patch, 必需

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • force (in query): boolean

    force

  • pretty (在查询中): string

    pretty

响应

200 (ServiceAccount): OK

201 (ServiceAccount): Created

401: 未授权

delete 删除 ServiceAccount

HTTP 请求

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

Parameters

响应

200 (ServiceAccount): OK

202 (ServiceAccount): Accepted

401: 未授权

deletecollection 删除 ServiceAccount 集合

HTTP 请求

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

Parameters

响应

200 (Status): 确定

401: 未授权

本页面是自动生成的。

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

上次修改时间:2025 年 4 月 9 日下午 6:36 PST:更新 v1.32 的 API 参考文档 (a3b579d035)