Show / Hide Table of Contents

Class ClusterProps

Common configuration props for EKS clusters.

Inheritance
object
ClusterProps
Implements
IClusterProps
IClusterOptions
ICommonClusterOptions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: Amazon.CDK.AWS.EKS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ClusterProps : IClusterProps, IClusterOptions, ICommonClusterOptions
Syntax (vb)
Public Class ClusterProps Implements IClusterProps, IClusterOptions, ICommonClusterOptions
Remarks

ExampleMetadata: infused

Examples
using Amazon.CDK.LambdaLayer.KubectlV33;

            // or
            Vpc vpc;


            new Cluster(this, "MyCluster", new ClusterProps {
                KubectlMemory = Size.Gibibytes(4),
                Version = KubernetesVersion.V1_33,
                KubectlLayer = new KubectlV33Layer(this, "kubectl")
            });
            Cluster.FromClusterAttributes(this, "MyCluster", new ClusterAttributes {
                KubectlMemory = Size.Gibibytes(4),
                Vpc = vpc,
                ClusterName = "cluster-name"
            });

Synopsis

Constructors

ClusterProps()

Common configuration props for EKS clusters.

Properties

AlbController

Install the AWS Load Balancer Controller onto the cluster.

AuthenticationMode

The desired authentication mode for the cluster.

AwscliLayer

An AWS Lambda layer that contains the aws CLI.

BootstrapClusterCreatorAdminPermissions

Whether or not IAM principal of the cluster creator was set as a cluster admin access entry during cluster creation time.

BootstrapSelfManagedAddons

If you set this value to False when creating a cluster, the default networking add-ons will not be installed.

ClusterHandlerEnvironment

Custom environment variables when interacting with the EKS endpoint to manage the cluster lifecycle.

ClusterHandlerSecurityGroup

A security group to associate with the Cluster Handler's Lambdas.

ClusterLogging

The cluster log types which you want to enable.

ClusterName

Name for the cluster.

CoreDnsComputeType

Controls the "eks.amazonaws.com/compute-type" annotation in the CoreDNS configuration on your cluster to determine which compute type to use for CoreDNS.

DefaultCapacity

Number of instances to allocate as an initial capacity for this cluster.

DefaultCapacityInstance

The instance type to use for the default capacity.

DefaultCapacityType

The default capacity type for the cluster.

EndpointAccess

Configure access to the Kubernetes API server endpoint..

IpFamily

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

KubectlEnvironment

Environment variables for the kubectl execution.

KubectlLambdaRole

The IAM role to pass to the Kubectl Lambda Handler.

KubectlLayer

An AWS Lambda Layer which includes kubectl and Helm.

KubectlMemory

Amount of memory to allocate to the provider's lambda function.

MastersRole

An IAM role that will be added to the system:masters Kubernetes RBAC group.

OnEventLayer

An AWS Lambda Layer which includes the NPM dependency proxy-agent.

OutputClusterName

Determines whether a CloudFormation output with the name of the cluster will be synthesized.

OutputConfigCommand

Determines whether a CloudFormation output with the aws eks update-kubeconfig command will be synthesized.

OutputMastersRoleArn

Determines whether a CloudFormation output with the ARN of the "masters" IAM role will be synthesized (if mastersRole is specified).

PlaceClusterHandlerInVpc

If set to true, the cluster handler functions will be placed in the private subnets of the cluster vpc, subject to the vpcSubnets selection strategy.

Prune

Indicates whether Kubernetes resources added through addManifest() can be automatically pruned.

RemoteNodeNetworks

IPv4 CIDR blocks defining the expected address range of hybrid nodes that will join the cluster.

RemotePodNetworks

IPv4 CIDR blocks for Pods running Kubernetes webhooks on hybrid nodes.

Role

Role that provides permissions for the Kubernetes control plane to make calls to AWS API operations on your behalf.

SecretsEncryptionKey

KMS secret for envelope encryption for Kubernetes secrets.

SecurityGroup

Security Group to use for Control Plane ENIs.

ServiceIpv4Cidr

The CIDR block to assign Kubernetes service IP addresses from.

Tags

The tags assigned to the EKS cluster.

Version

The Kubernetes version to run in the cluster.

Vpc

The VPC in which to create the Cluster.

VpcSubnets

Where to place EKS Control Plane ENIs.

Constructors

ClusterProps()

Common configuration props for EKS clusters.

public ClusterProps()
Remarks

ExampleMetadata: infused

Examples
using Amazon.CDK.LambdaLayer.KubectlV33;

            // or
            Vpc vpc;


            new Cluster(this, "MyCluster", new ClusterProps {
                KubectlMemory = Size.Gibibytes(4),
                Version = KubernetesVersion.V1_33,
                KubectlLayer = new KubectlV33Layer(this, "kubectl")
            });
            Cluster.FromClusterAttributes(this, "MyCluster", new ClusterAttributes {
                KubectlMemory = Size.Gibibytes(4),
                Vpc = vpc,
                ClusterName = "cluster-name"
            });

Properties

AlbController

Install the AWS Load Balancer Controller onto the cluster.

public IAlbControllerOptions? AlbController { get; set; }
Property Value

IAlbControllerOptions

Remarks

Default: - The controller is not installed.

See: https://kubernetes-sigs.github.io/aws-load-balancer-controller

AuthenticationMode

The desired authentication mode for the cluster.

public AuthenticationMode? AuthenticationMode { get; set; }
Property Value

AuthenticationMode?

Remarks

Default: AuthenticationMode.CONFIG_MAP

AwscliLayer

An AWS Lambda layer that contains the aws CLI.

public ILayerVersion? AwscliLayer { get; set; }
Property Value

ILayerVersion

Remarks

The handler expects the layer to include the following executables:

/opt/awscli/aws

Default: - a default layer with the AWS CLI 1.x

BootstrapClusterCreatorAdminPermissions

Whether or not IAM principal of the cluster creator was set as a cluster admin access entry during cluster creation time.

public bool? BootstrapClusterCreatorAdminPermissions { get; set; }
Property Value

bool?

Remarks

Changing this value after the cluster has been created will result in the cluster being replaced.

Default: true

BootstrapSelfManagedAddons

If you set this value to False when creating a cluster, the default networking add-ons will not be installed.

public bool? BootstrapSelfManagedAddons { get; set; }
Property Value

bool?

Remarks

The default networking addons include vpc-cni, coredns, and kube-proxy. Use this option when you plan to install third-party alternative add-ons or self-manage the default networking add-ons.

Changing this value after the cluster has been created will result in the cluster being replaced.

Default: true

ClusterHandlerEnvironment

Custom environment variables when interacting with the EKS endpoint to manage the cluster lifecycle.

public IDictionary<string, string>? ClusterHandlerEnvironment { get; set; }
Property Value

IDictionary<string, string>

Remarks

Default: - No environment variables.

ClusterHandlerSecurityGroup

A security group to associate with the Cluster Handler's Lambdas.

public ISecurityGroup? ClusterHandlerSecurityGroup { get; set; }
Property Value

ISecurityGroup

Remarks

The Cluster Handler's Lambdas are responsible for calling AWS's EKS API.

Requires placeClusterHandlerInVpc to be set to true.

Default: - No security group.

ClusterLogging

The cluster log types which you want to enable.

public ClusterLoggingTypes[]? ClusterLogging { get; set; }
Property Value

ClusterLoggingTypes[]

Remarks

Default: - none

ClusterName

Name for the cluster.

public string? ClusterName { get; set; }
Property Value

string

Remarks

Default: - Automatically generated name

CoreDnsComputeType

Controls the "eks.amazonaws.com/compute-type" annotation in the CoreDNS configuration on your cluster to determine which compute type to use for CoreDNS.

public CoreDnsComputeType? CoreDnsComputeType { get; set; }
Property Value

CoreDnsComputeType?

Remarks

Default: CoreDnsComputeType.EC2 (for FargateCluster the default is FARGATE)

DefaultCapacity

Number of instances to allocate as an initial capacity for this cluster.

public double? DefaultCapacity { get; set; }
Property Value

double?

Remarks

Instance type can be configured through defaultCapacityInstanceType, which defaults to m5.large.

Use cluster.addAutoScalingGroupCapacity to add additional customized capacity. Set this to 0 is you wish to avoid the initial capacity allocation.

Default: 2

DefaultCapacityInstance

The instance type to use for the default capacity.

public InstanceType? DefaultCapacityInstance { get; set; }
Property Value

InstanceType

Remarks

This will only be taken into account if defaultCapacity is > 0.

Default: m5.large

DefaultCapacityType

The default capacity type for the cluster.

public DefaultCapacityType? DefaultCapacityType { get; set; }
Property Value

DefaultCapacityType?

Remarks

Default: NODEGROUP

EndpointAccess

Configure access to the Kubernetes API server endpoint..

public EndpointAccess? EndpointAccess { get; set; }
Property Value

EndpointAccess

Remarks

Default: EndpointAccess.PUBLIC_AND_PRIVATE

See: https://docs.aws.amazon.com/eks/latest/userguide/cluster-endpoint.html

IpFamily

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

public IpFamily? IpFamily { get; set; }
Property Value

IpFamily?

Remarks

Default: - IpFamily.IP_V4

See: https://docs.aws.amazon.com/eks/latest/APIReference/API_KubernetesNetworkConfigRequest.html#AmazonEKS-Type-KubernetesNetworkConfigRequest-ipFamily

KubectlEnvironment

Environment variables for the kubectl execution.

public IDictionary<string, string>? KubectlEnvironment { get; set; }
Property Value

IDictionary<string, string>

Remarks

Only relevant for kubectl enabled clusters.

Default: - No environment variables.

KubectlLambdaRole

The IAM role to pass to the Kubectl Lambda Handler.

public IRole? KubectlLambdaRole { get; set; }
Property Value

IRole

Remarks

Default: - Default Lambda IAM Execution Role

KubectlLayer

An AWS Lambda Layer which includes kubectl and Helm.

public ILayerVersion KubectlLayer { get; set; }
Property Value

ILayerVersion

Remarks

This layer is used by the kubectl handler to apply manifests and install helm charts. You must pick an appropriate releases of one of the @aws-cdk/layer-kubectl-vXX packages, that works with the version of Kubernetes you have chosen.

The handler expects the layer to include the following executables:

/opt/helm/helm
/opt/kubectl/kubectl

KubectlMemory

Amount of memory to allocate to the provider's lambda function.

public Size? KubectlMemory { get; set; }
Property Value

Size

Remarks

Default: Size.gibibytes(1)

MastersRole

An IAM role that will be added to the system:masters Kubernetes RBAC group.

public IRole? MastersRole { get; set; }
Property Value

IRole

Remarks

Default: - no masters role.

See: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#default-roles-and-role-bindings

OnEventLayer

An AWS Lambda Layer which includes the NPM dependency proxy-agent.

public ILayerVersion? OnEventLayer { get; set; }
Property Value

ILayerVersion

Remarks

This layer is used by the onEvent handler to route AWS SDK requests through a proxy.

By default, the provider will use the layer included in the "aws-lambda-layer-node-proxy-agent" SAR application which is available in all commercial regions.

To deploy the layer locally define it in your app as follows:

var layer = new LayerVersion(this, "proxy-agent-layer", new LayerVersionProps {
    Code = Code.FromAsset($"{__dirname}/layer.zip"),
    CompatibleRuntimes = new [] { Runtime.NODEJS_LATEST }
});

Default: - a layer bundled with this module.

OutputClusterName

Determines whether a CloudFormation output with the name of the cluster will be synthesized.

public bool? OutputClusterName { get; set; }
Property Value

bool?

Remarks

Default: false

OutputConfigCommand

Determines whether a CloudFormation output with the aws eks update-kubeconfig command will be synthesized.

public bool? OutputConfigCommand { get; set; }
Property Value

bool?

Remarks

This command will include the cluster name and the ARN of the masters IAM role.

Note: If mastersRole is not specified, this property will be ignored and no config command will be emitted.

Default: true

See: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_eks-readme.html#masters-role

OutputMastersRoleArn

Determines whether a CloudFormation output with the ARN of the "masters" IAM role will be synthesized (if mastersRole is specified).

public bool? OutputMastersRoleArn { get; set; }
Property Value

bool?

Remarks

Default: false

PlaceClusterHandlerInVpc

If set to true, the cluster handler functions will be placed in the private subnets of the cluster vpc, subject to the vpcSubnets selection strategy.

public bool? PlaceClusterHandlerInVpc { get; set; }
Property Value

bool?

Remarks

Default: false

Prune

Indicates whether Kubernetes resources added through addManifest() can be automatically pruned.

public bool? Prune { get; set; }
Property Value

bool?

Remarks

When this is enabled (default), prune labels will be allocated and injected to each resource. These labels will then be used when issuing the kubectl apply operation with the --prune switch.

Default: true

RemoteNodeNetworks

IPv4 CIDR blocks defining the expected address range of hybrid nodes that will join the cluster.

public IRemoteNodeNetwork[]? RemoteNodeNetworks { get; set; }
Property Value

IRemoteNodeNetwork[]

Remarks

Default: - none

RemotePodNetworks

IPv4 CIDR blocks for Pods running Kubernetes webhooks on hybrid nodes.

public IRemotePodNetwork[]? RemotePodNetworks { get; set; }
Property Value

IRemotePodNetwork[]

Remarks

Default: - none

Role

Role that provides permissions for the Kubernetes control plane to make calls to AWS API operations on your behalf.

public IRole? Role { get; set; }
Property Value

IRole

Remarks

Default: - A role is automatically created for you

SecretsEncryptionKey

KMS secret for envelope encryption for Kubernetes secrets.

public IKey? SecretsEncryptionKey { get; set; }
Property Value

IKey

Remarks

Default: - By default, Kubernetes stores all secret object data within etcd and all etcd volumes used by Amazon EKS are encrypted at the disk-level using AWS-Managed encryption keys.

SecurityGroup

Security Group to use for Control Plane ENIs.

public ISecurityGroup? SecurityGroup { get; set; }
Property Value

ISecurityGroup

Remarks

Default: - A security group is automatically created

ServiceIpv4Cidr

The CIDR block to assign Kubernetes service IP addresses from.

public string? ServiceIpv4Cidr { get; set; }
Property Value

string

Remarks

Default: - Kubernetes assigns addresses from either the 10.100.0.0/16 or 172.20.0.0/16 CIDR blocks

See: https://docs.aws.amazon.com/eks/latest/APIReference/API_KubernetesNetworkConfigRequest.html#AmazonEKS-Type-KubernetesNetworkConfigRequest-serviceIpv4Cidr

Tags

The tags assigned to the EKS cluster.

public IDictionary<string, string>? Tags { get; set; }
Property Value

IDictionary<string, string>

Remarks

Default: - none

Version

The Kubernetes version to run in the cluster.

public KubernetesVersion Version { get; set; }
Property Value

KubernetesVersion

Remarks

ExampleMetadata: infused

Vpc

The VPC in which to create the Cluster.

public IVpc? Vpc { get; set; }
Property Value

IVpc

Remarks

Default: - a VPC with default configuration will be created and can be accessed through cluster.vpc.

VpcSubnets

Where to place EKS Control Plane ENIs.

public ISubnetSelection[]? VpcSubnets { get; set; }
Property Value

ISubnetSelection[]

Remarks

For example, to only select private subnets, supply the following:

vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }]

Default: - All public and private subnets

Implements

IClusterProps
IClusterOptions
ICommonClusterOptions
Back to top Generated by DocFX