MDAA TS Docs
    Preparing search index...

    A construct for creating a compliant EKS cluster resource.

    Hierarchy

    • Cluster
      • MdaaEKSCluster
    Index

    Constructors

    Properties

    _awsAuth?: AwsAuth

    Manages the aws-auth config map.

    adminRole: Role

    An IAM role with administrative permissions to create or update the cluster. This role also has systems:master permissions.

    albController?: AlbController

    The ALB Controller construct defined for this cluster. Will be undefined if albController wasn't configured.

    authenticationMode?: AuthenticationMode

    The authentication mode for the Amazon EKS cluster.

    The authentication mode determines how users and applications authenticate to the Kubernetes API server.

    CONFIG_MAP.
    
    awscliLayer?: ILayerVersion

    An AWS Lambda layer that contains the aws CLI.

    If not defined, a default layer will be used containing the AWS CLI 1.x.

    clusterArn: string

    The AWS generated ARN for the Cluster resource

    For example, arn:aws:eks:us-west-2:666666666666:cluster/prod

    clusterCertificateAuthorityData: string

    The certificate-authority-data for your cluster.

    clusterEncryptionConfigKeyArn: string

    Amazon Resource Name (ARN) or alias of the customer master key (CMK).

    clusterEndpoint: string

    The endpoint URL for the Cluster

    This is the URL inside the kubeconfig file to use with kubectl

    For example, https://5E1D0CEXAMPLEA591B746AFC5AB30262.yl4.us-west-2.eks.amazonaws.com

    clusterFargateProfileArn: string
    clusterHandlerSecurityGroup?: ISecurityGroup

    A security group to associate with the Cluster Handler's Lambdas. The Cluster Handler's Lambdas are responsible for calling AWS's EKS API.

    Requires placeClusterHandlerInVpc to be set to true.

    - No security group.
    
    clusterName: string

    The Name of the created EKS Cluster

    clusterSecurityGroup: ISecurityGroup

    The cluster security group that was created by Amazon EKS for the cluster.

    clusterSecurityGroupId: string

    The id of the cluster security group that was created by Amazon EKS for the cluster.

    connections: Connections

    Manages connection rules (Security Group Rules) for the cluster

    Cluster

    defaultCapacity?: AutoScalingGroup

    The auto scaling group that hosts the default capacity for this cluster. This will be undefined if the defaultCapacityType is not EC2 or defaultCapacityType is EC2 but default capacity is set to 0.

    defaultNodegroup?: Nodegroup

    The node group that hosts the default capacity for this cluster. This will be undefined if the defaultCapacityType is EC2 or defaultCapacityType is NODEGROUP but default capacity is set to 0.

    efsStorageClassName: string
    env: ResourceEnvironment

    The environment this resource belongs to. For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

    iamOidcIdentityProvider: OpenIdConnectProvider
    ipFamily?: IpFamily

    Specify which IP family is used to assign Kubernetes pod and service IP addresses.

    kubectlEnvironment?: { [key: string]: string }

    Custom environment variables when running kubectl against this cluster.

    kubectlLambdaRole?: IRole

    An IAM role that can perform kubectl operations against this cluster.

    The role should be mapped to the system:masters Kubernetes RBAC role.

    This role is directly passed to the lambda handler that sends Kube Ctl commands to the cluster.

    - if not specified, the default role created by a lambda function will
    be used.
    kubectlLayer?: ILayerVersion

    An AWS Lambda layer that includes kubectl and helm

    kubectlMemory?: Size

    The amount of memory allocated to the kubectl provider's lambda function.

    kubectlPrivateSubnets?: ISubnet[]

    Subnets to host the kubectl compute resources.

    - If not specified, the k8s endpoint is expected to be accessible
    publicly.
    kubectlRole?: IRole

    An IAM role that can perform kubectl operations against this cluster.

    The role should be mapped to the system:masters Kubernetes RBAC role.

    kubectlSecurityGroup?: ISecurityGroup

    A security group to use for kubectl execution.

    - If not specified, the k8s endpoint is expected to be accessible
    publicly.
    mdaaKubeCtlProvider: IKubectlProvider
    mgmtInstance?: IInstance
    node: Node

    The tree node.

    onEventLayer?: ILayerVersion

    The AWS Lambda layer that contains the NPM dependency proxy-agent. If undefined, a SAR app that contains this layer will be used.

    physicalName: string

    Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.

    This value will resolve to one of the following:

    • a concrete value (e.g. "my-awesome-bucket")
    • undefined, when a name should be generated by CloudFormation
    • a concrete name generated automatically during synthesis, in cross-environment scenarios.
    prune: boolean

    Determines if Kubernetes resources can be pruned automatically.

    role: IRole

    IAM role assumed by the EKS Control Plane

    stack: Stack

    The stack in which this resource is defined.

    vpc: IVpc

    The VPC in which this Cluster was created

    PROPERTY_INJECTION_ID: string

    Uniquely identifies this class.

    Accessors

    • get awsAuth(): AwsAuth

      Lazily creates the AwsAuth resource, which manages AWS authentication mapping.

      Returns AwsAuth

    • get clusterOpenIdConnectIssuer(): string

      If this cluster is kubectl-enabled, returns the OpenID Connect issuer. This is because the values is only be retrieved by the API and not exposed by CloudFormation. If this cluster is not kubectl-enabled (i.e. uses the stock CfnCluster), this is undefined.

      Returns string

    • get clusterOpenIdConnectIssuerUrl(): string

      If this cluster is kubectl-enabled, returns the OpenID Connect issuer url. This is because the values is only be retrieved by the API and not exposed by CloudFormation. If this cluster is not kubectl-enabled (i.e. uses the stock CfnCluster), this is undefined.

      Returns string

    • get eksPodIdentityAgent(): IAddon | undefined

      Retrieves the EKS Pod Identity Agent addon for the EKS cluster.

      The EKS Pod Identity Agent is responsible for managing the temporary credentials used by pods in the cluster to access AWS resources. It runs as a DaemonSet on each node and provides the necessary credentials to the pods based on their associated service account.

      Returns IAddon | undefined

    • get openIdConnectProvider(): IOpenIdConnectProvider

      An OpenIdConnectProvider resource associated with this cluster, and which can be used to link this cluster to AWS IAM.

      A provider will only be defined if this property is accessed (lazy initialization).

      Returns IOpenIdConnectProvider

    Methods

    • Internal

      Internal API used by FargateProfile to keep inventory of Fargate profiles associated with this cluster, for the sake of ensuring the profiles are created sequentially.

      Parameters

      • fargateProfile: FargateProfile

      Returns FargateProfile[]

      the list of FargateProfiles attached to this cluster, including the one just attached.

    • Internal

      Adds a resource scope that requires kubectl to this cluster and returns the KubectlProvider which is the custom resource provider that should be used as the resource provider.

      Called from HelmResource and KubernetesResource

      Parameters

      • resourceScope: Construct

        the construct scope in which kubectl resources are defined.

      Returns KubectlProvider

    • Internal

      Called when this resource is referenced across environments (account/region) to order to request that a physical name will be generated for this resource during synthesis, so the resource can be referenced through its absolute name/arn.

      Returns void

    • Add nodes to this EKS cluster

      The nodes will automatically be configured with the right VPC and AMI for the instance type and Kubernetes version.

      Note that if you specify updateType: RollingUpdate or updateType: ReplacingUpdate, your nodes might be replaced at deploy time without notice in case the recommended AMI for your machine image type has been updated by AWS. The default behavior for updateType is None, which means only new instances will be launched using the new AMI.

      Spot instances will be labeled lifecycle=Ec2Spot and tainted with PreferNoSchedule. In addition, the spot interrupt handler daemon will be installed on all spot instances to handle EC2 Spot Instance Termination Notices.

      Parameters

      • id: string
      • options: AutoScalingGroupCapacityOptions

      Returns AutoScalingGroup

    • Defines a CDK8s chart in this cluster.

      Parameters

      • id: string

        logical id of this chart.

      • chart: Construct

        the cdk8s chart.

      • Optionaloptions: KubernetesManifestOptions

      Returns KubernetesManifest

      a KubernetesManifest construct representing the chart.

    • Defines a Helm chart in this cluster.

      Parameters

      • id: string

        logical id of this chart.

      • options: HelmChartOptions

        options of this chart.

      Returns HelmChart

      a HelmChart construct

    • Defines a Kubernetes resource in this cluster.

      The manifest will be applied/deleted using kubectl as needed.

      Parameters

      • id: string

        logical id of this manifest

      • ...manifest: Record<string, any>[]

        a list of Kubernetes resource specifications

      Returns KubernetesManifest

      a KubernetesResource object.

    • Parameters

      • scope: Construct
      • id: string
      • namespaceName: string
      • OptionalsecurityGroup: ISecurityGroup

      Returns KubernetesManifest

    • Add managed nodegroup to this Amazon EKS cluster

      This method will create a new managed nodegroup and add into the capacity.

      Parameters

      • id: string

        The ID of the nodegroup

      • Optionaloptions: NodegroupOptions

        options for creating a new nodegroup

      Returns Nodegroup

    • Creates a new service account with corresponding IAM Role (IRSA).

      Parameters

      • id: string

        logical id of service account

      • Optionaloptions: ServiceAccountOptions

        service account options

      Returns ServiceAccount

    • Apply the given removal policy to this resource

      The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

      The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

      Parameters

      • policy: RemovalPolicy

      Returns void

    • Connect capacity in the form of an existing AutoScalingGroup to the EKS cluster.

      The AutoScalingGroup must be running an EKS-optimized AMI containing the /etc/eks/bootstrap.sh script. This method will configure Security Groups, add the right policies to the instance role, apply the right tags, and add the required user data to the instance's launch configuration.

      Spot instances will be labeled lifecycle=Ec2Spot and tainted with PreferNoSchedule. If kubectl is enabled, the spot interrupt handler daemon will be installed on all spot instances to handle EC2 Spot Instance Termination Notices.

      Prefer to use addAutoScalingGroupCapacity if possible.

      Parameters

      • autoScalingGroup: AutoScalingGroup

        [disable-awslint:ref-via-interface]

      • options: AutoScalingGroupOptions

        options for adding auto scaling groups, like customizing the bootstrap script

      Returns void

    • Returns string

    • Fetch the load balancer address of an ingress backed by a load balancer.

      Parameters

      • ingressName: string

        The name of the ingress.

      • Optionaloptions: IngressLoadBalancerAddressOptions

        Additional operation options.

      Returns string

    • Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn).

      Normally, this token will resolve to arnAttr, but if the resource is referenced across environments, arnComponents will be used to synthesize a concrete ARN with the resource's physical name. Make sure to reference this.physicalName in arnComponents.

      Parameters

      • arnAttr: string

        The CFN attribute which resolves to the ARN of the resource. Commonly it will be called "Arn" (e.g. resource.attrArn), but sometimes it's the CFN resource's ref.

      • arnComponents: ArnComponents

        The format of the ARN of this resource. You must reference this.physicalName somewhere within the ARN in order for cross-environment references to work.

      Returns string

    • Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName).

      Normally, this token will resolve to nameAttr, but if the resource is referenced across environments, it will be resolved to this.physicalName, which will be a concrete name.

      Parameters

      • nameAttr: string

        The CFN attribute which resolves to the resource's name. Commonly this is the resource's ref.

      Returns string

    • Fetch the load balancer address of a service of type 'LoadBalancer'.

      Parameters

      • serviceName: string

        The name of the service.

      • Optionaloptions: ServiceLoadBalancerAddressOptions

        Additional operation options.

      Returns string

    • Grants the specified IAM principal access to the EKS cluster based on the provided access policies.

      This method creates an AccessEntry construct that grants the specified IAM principal the access permissions defined by the provided IAccessPolicy array. This allows the IAM principal to perform the actions permitted by the access policies within the EKS cluster.

      Parameters

      • id: string

        The ID of the AccessEntry construct to be created.

      • principal: string

        The IAM principal (role or user) to be granted access to the EKS cluster.

      • accessPolicies: IAccessPolicy[]

        An array of IAccessPolicy objects that define the access permissions to be granted to the IAM principal.

      Returns void

    • Returns a string representation of this construct.

      Returns string

    • Import an existing cluster

      Parameters

      • scope: Construct

        the construct scope, in most cases 'this'

      • id: string

        the id or name to import as

      • attrs: ClusterAttributes

        the cluster properties to use for importing information

      Returns ICluster

    • Checks if x is a construct.

      Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

      Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

      Parameters

      • x: any

        Any object

      Returns x is Construct

      true if x is an object created from a class which extends Construct.

    • Returns true if the construct was created by CDK, and false otherwise

      Parameters

      • construct: IConstruct

      Returns boolean

    • Check whether the given construct is a Resource

      Parameters

      • construct: IConstruct

      Returns construct is Resource