Class ServiceAccount

  • All Implemented Interfaces:
    IApiEndpoint, IApiResource, IResource, IServiceAccount, ISubject, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

    @Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
               date="2023-07-08T00:25:14.296Z")
    @Stability(Stable)
    public class ServiceAccount
    extends Resource
    implements IServiceAccount, ISubject
    A service account provides an identity for processes that run in a Pod.

    When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).

    See Also:
    https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account
    • Constructor Detail

      • ServiceAccount

        protected ServiceAccount​(software.amazon.jsii.JsiiObjectRef objRef)
      • ServiceAccount

        protected ServiceAccount​(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
      • ServiceAccount

        @Stability(Stable)
        public ServiceAccount​(@NotNull
                              software.constructs.Construct scope,
                              @NotNull
                              String id,
                              @Nullable
                              ServiceAccountProps props)
        Parameters:
        scope - This parameter is required.
        id - This parameter is required.
        props -
      • ServiceAccount

        @Stability(Stable)
        public ServiceAccount​(@NotNull
                              software.constructs.Construct scope,
                              @NotNull
                              String id)
        Parameters:
        scope - This parameter is required.
        id - This parameter is required.
    • Method Detail

      • fromServiceAccountName

        @Stability(Stable)
        @NotNull
        public static IServiceAccount fromServiceAccountName​(@NotNull
                                                             software.constructs.Construct scope,
                                                             @NotNull
                                                             String id,
                                                             @NotNull
                                                             String name,
                                                             @Nullable
                                                             FromServiceAccountNameOptions options)
        Imports a service account from the cluster as a reference.

        Parameters:
        scope - This parameter is required.
        id - This parameter is required.
        name - The name of the service account resource. This parameter is required.
        options - additional options.
      • fromServiceAccountName

        @Stability(Stable)
        @NotNull
        public static IServiceAccount fromServiceAccountName​(@NotNull
                                                             software.constructs.Construct scope,
                                                             @NotNull
                                                             String id,
                                                             @NotNull
                                                             String name)
        Imports a service account from the cluster as a reference.

        Parameters:
        scope - This parameter is required.
        id - This parameter is required.
        name - The name of the service account resource. This parameter is required.
      • addSecret

        @Stability(Stable)
        public void addSecret​(@NotNull
                              ISecret secr)
        Allow a secret to be accessed by pods using this service account.

        Parameters:
        secr - The secret. This parameter is required.
      • getAutomountToken

        @Stability(Stable)
        @NotNull
        public Boolean getAutomountToken()
        Whether or not a token is automatically mounted for this service account.
      • getSecrets

        @Stability(Stable)
        @NotNull
        public List<ISecret> getSecrets()
        List of secrets allowed to be used by pods running using this service account.

        Returns a copy. To add a secret, use addSecret().