Class ServiceAccount

  • All Implemented Interfaces:
    IResource, IServiceAccount, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

    @Generated(value="jsii-pacmak/1.50.0 (build d1830a4)",
               date="2022-01-03T09:09:28.079Z")
    @Stability(Stable)
    public class ServiceAccount
    extends Resource
    implements IServiceAccount
    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).

    • 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
                                                             String name)
        Imports a service account from the cluster as a reference.

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

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

        Parameters:
        secret - The secret. This parameter is required.
      • getApiObject

        @Stability(Stable)
        @NotNull
        protected org.cdk8s.ApiObject getApiObject()
        The underlying cdk8s API object.

        Specified by:
        getApiObject in class Resource
        See Also:
        base.Resource.apiObject
      • 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().