--- api_metadata: apiVersion: "v1" import: "k8s.io/api/core/v1" kind: "ServiceAccount" content_type: "api_reference" description: "ServiceAccount binds together: * a name, understood by users, and perhaps by peripheral systems, for an identity * a principal that can be authenticated and authorized * a set of secrets." title: "ServiceAccount" weight: 1 auto_generated: true --- `apiVersion: v1` `import "k8s.io/api/core/v1"` ## ServiceAccount {#ServiceAccount} ServiceAccount binds together: * a name, understood by users, and perhaps by peripheral systems, for an identity * a principal that can be authenticated and authorized * a set of secrets
- **apiVersion**: v1 - **kind**: ServiceAccount - **metadata** (}}">ObjectMeta) Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - **automountServiceAccountToken** (boolean) AutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted. Can be overridden at the pod level. - **imagePullSecrets** ([]}}">LocalObjectReference) ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod - **secrets** ([]}}">ObjectReference) *Patch strategy: merge on key `name`* Secrets is the list of secrets allowed to be used by pods running using this ServiceAccount. More info: https://kubernetes.io/docs/concepts/configuration/secret ## ServiceAccountList {#ServiceAccountList} ServiceAccountList is a list of ServiceAccount objects
- **apiVersion**: v1 - **kind**: ServiceAccountList - **metadata** (}}">ListMeta) Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - **items** ([]}}">ServiceAccount), required List of ServiceAccounts. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ ## Operations {#Operations}
### `get` read the specified ServiceAccount #### HTTP Request GET /api/v1/namespaces/{namespace}/serviceaccounts/{name} #### Parameters - **name** (*in path*): string, required name of the ServiceAccount - **namespace** (*in path*): string, required }}">namespace - **pretty** (*in query*): string }}">pretty #### Response 200 (}}">ServiceAccount): OK 401: Unauthorized ### `list` list or watch objects of kind ServiceAccount #### HTTP Request GET /api/v1/namespaces/{namespace}/serviceaccounts #### Parameters - **namespace** (*in path*): string, required }}">namespace - **allowWatchBookmarks** (*in query*): boolean }}">allowWatchBookmarks - **continue** (*in query*): string }}">continue - **fieldSelector** (*in query*): string }}">fieldSelector - **labelSelector** (*in query*): string }}">labelSelector - **limit** (*in query*): integer }}">limit - **pretty** (*in query*): string }}">pretty - **resourceVersion** (*in query*): string }}">resourceVersion - **resourceVersionMatch** (*in query*): string }}">resourceVersionMatch - **timeoutSeconds** (*in query*): integer }}">timeoutSeconds - **watch** (*in query*): boolean }}">watch #### Response 200 (}}">ServiceAccountList): OK 401: Unauthorized ### `list` list or watch objects of kind ServiceAccount #### HTTP Request GET /api/v1/serviceaccounts #### Parameters - **allowWatchBookmarks** (*in query*): boolean }}">allowWatchBookmarks - **continue** (*in query*): string }}">continue - **fieldSelector** (*in query*): string }}">fieldSelector - **labelSelector** (*in query*): string }}">labelSelector - **limit** (*in query*): integer }}">limit - **pretty** (*in query*): string }}">pretty - **resourceVersion** (*in query*): string }}">resourceVersion - **resourceVersionMatch** (*in query*): string }}">resourceVersionMatch - **timeoutSeconds** (*in query*): integer }}">timeoutSeconds - **watch** (*in query*): boolean }}">watch #### Response 200 (}}">ServiceAccountList): OK 401: Unauthorized ### `create` create a ServiceAccount #### HTTP Request POST /api/v1/namespaces/{namespace}/serviceaccounts #### Parameters - **namespace** (*in path*): string, required }}">namespace - **body**: }}">ServiceAccount, required - **dryRun** (*in query*): string }}">dryRun - **fieldManager** (*in query*): string }}">fieldManager - **pretty** (*in query*): string }}">pretty #### Response 200 (}}">ServiceAccount): OK 201 (}}">ServiceAccount): Created 202 (}}">ServiceAccount): Accepted 401: Unauthorized ### `update` replace the specified ServiceAccount #### HTTP Request PUT /api/v1/namespaces/{namespace}/serviceaccounts/{name} #### Parameters - **name** (*in path*): string, required name of the ServiceAccount - **namespace** (*in path*): string, required }}">namespace - **body**: }}">ServiceAccount, required - **dryRun** (*in query*): string }}">dryRun - **fieldManager** (*in query*): string }}">fieldManager - **pretty** (*in query*): string }}">pretty #### Response 200 (}}">ServiceAccount): OK 201 (}}">ServiceAccount): Created 401: Unauthorized ### `patch` partially update the specified ServiceAccount #### HTTP Request PATCH /api/v1/namespaces/{namespace}/serviceaccounts/{name} #### Parameters - **name** (*in path*): string, required name of the ServiceAccount - **namespace** (*in path*): string, required }}">namespace - **body**: }}">Patch, required - **dryRun** (*in query*): string }}">dryRun - **fieldManager** (*in query*): string }}">fieldManager - **force** (*in query*): boolean }}">force - **pretty** (*in query*): string }}">pretty #### Response 200 (}}">ServiceAccount): OK 401: Unauthorized ### `delete` delete a ServiceAccount #### HTTP Request DELETE /api/v1/namespaces/{namespace}/serviceaccounts/{name} #### Parameters - **name** (*in path*): string, required name of the ServiceAccount - **namespace** (*in path*): string, required }}">namespace - **body**: }}">DeleteOptions - **dryRun** (*in query*): string }}">dryRun - **gracePeriodSeconds** (*in query*): integer }}">gracePeriodSeconds - **pretty** (*in query*): string }}">pretty - **propagationPolicy** (*in query*): string }}">propagationPolicy #### Response 200 (}}">ServiceAccount): OK 202 (}}">ServiceAccount): Accepted 401: Unauthorized ### `deletecollection` delete collection of ServiceAccount #### HTTP Request DELETE /api/v1/namespaces/{namespace}/serviceaccounts #### Parameters - **namespace** (*in path*): string, required }}">namespace - **body**: }}">DeleteOptions - **continue** (*in query*): string }}">continue - **dryRun** (*in query*): string }}">dryRun - **fieldSelector** (*in query*): string }}">fieldSelector - **gracePeriodSeconds** (*in query*): integer }}">gracePeriodSeconds - **labelSelector** (*in query*): string }}">labelSelector - **limit** (*in query*): integer }}">limit - **pretty** (*in query*): string }}">pretty - **propagationPolicy** (*in query*): string }}">propagationPolicy - **resourceVersion** (*in query*): string }}">resourceVersion - **resourceVersionMatch** (*in query*): string }}">resourceVersionMatch - **timeoutSeconds** (*in query*): integer }}">timeoutSeconds #### Response 200 (}}">Status): OK 401: Unauthorized