ClusterProps

class aws_cdk.aws_eks.ClusterProps(*, version, cluster_name=None, output_cluster_name=None, output_config_command=None, role=None, security_group=None, vpc=None, vpc_subnets=None, core_dns_compute_type=None, endpoint_access=None, kubectl_environment=None, masters_role=None, output_masters_role_arn=None, default_capacity=None, default_capacity_instance=None, default_capacity_type=None, kubectl_enabled=None)

Bases: aws_cdk.aws_eks.ClusterOptions

__init__(*, version, cluster_name=None, output_cluster_name=None, output_config_command=None, role=None, security_group=None, vpc=None, vpc_subnets=None, core_dns_compute_type=None, endpoint_access=None, kubectl_environment=None, masters_role=None, output_masters_role_arn=None, default_capacity=None, default_capacity_instance=None, default_capacity_type=None, kubectl_enabled=None)

Common configuration props for EKS clusters.

Parameters
  • version (KubernetesVersion) – The Kubernetes version to run in the cluster.

  • cluster_name (Optional[str]) – Name for the cluster. Default: - Automatically generated name

  • output_cluster_name (Optional[bool]) – Determines whether a CloudFormation output with the name of the cluster will be synthesized. Default: false

  • output_config_command (Optional[bool]) – Determines whether a CloudFormation output with the aws eks update-kubeconfig command will be synthesized. This command will include the cluster name and, if applicable, the ARN of the masters IAM role. Default: true

  • role (Optional[IRole]) – Role that provides permissions for the Kubernetes control plane to make calls to AWS API operations on your behalf. Default: - A role is automatically created for you

  • security_group (Optional[ISecurityGroup]) – Security Group to use for Control Plane ENIs. Default: - A security group is automatically created

  • vpc (Optional[IVpc]) – The VPC in which to create the Cluster. Default: - a VPC with default configuration will be created and can be accessed through cluster.vpc.

  • vpc_subnets (Optional[List[SubnetSelection]]) – Where to place EKS Control Plane ENIs. If you want to create public load balancers, this must include public subnets. For example, to only select private subnets, supply the following:: vpcSubnets: [ { subnetType: ec2.SubnetType.Private } ] Default: - All public and private subnets

  • core_dns_compute_type (Optional[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. Default: CoreDnsComputeType.EC2 (for FargateCluster the default is FARGATE)

  • endpoint_access (Optional[EndpointAccess]) – Configure access to the Kubernetes API server endpoint.. Default: EndpointAccess.PUBLIC_AND_PRIVATE

  • kubectl_environment (Optional[Mapping[str, str]]) – Environment variables for the kubectl execution. Only relevant for kubectl enabled clusters. Default: - No environment variables.

  • masters_role (Optional[IRole]) – An IAM role that will be added to the system:masters Kubernetes RBAC group. Default: - a role that assumable by anyone with permissions in the same account will automatically be defined

  • output_masters_role_arn (Optional[bool]) – Determines whether a CloudFormation output with the ARN of the “masters” IAM role will be synthesized (if mastersRole is specified). Default: false

  • default_capacity (Union[int, float, None]) – Number of instances to allocate as an initial capacity for this cluster. Instance type can be configured through defaultCapacityInstanceType, which defaults to m5.large. Use cluster.addCapacity to add additional customized capacity. Set this to 0 is you wish to avoid the initial capacity allocation. Default: 2

  • default_capacity_instance (Optional[InstanceType]) – The instance type to use for the default capacity. This will only be taken into account if defaultCapacity is > 0. Default: m5.large

  • default_capacity_type (Optional[DefaultCapacityType]) – The default capacity type for the cluster. Default: NODEGROUP

  • kubectl_enabled (Optional[bool]) – NOT SUPPORTED: We no longer allow disabling kubectl-support. Setting this option to false will throw an error. To temporary allow you to retain existing clusters created with kubectlEnabled: false, you can use eks.LegacyCluster class, which is a drop-in replacement for eks.Cluster with kubectlEnabled: false. Bear in mind that this is a temporary workaround. We have plans to remove eks.LegacyCluster. If you have a use case for using eks.LegacyCluster, please add a comment here https://github.com/aws/aws-cdk/issues/9332 and let us know so we can make sure to continue to support your use case with eks.Cluster. This issue also includes additional context into why this class is being removed. Default: true

stability :stability: experimental

Return type

None

Attributes

cluster_name

Name for the cluster.

default :default: - Automatically generated name

stability :stability: experimental

Return type

Optional[str]

core_dns_compute_type

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

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

stability :stability: experimental

Return type

Optional[CoreDnsComputeType]

default_capacity

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

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

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

default :default: 2

stability :stability: experimental

Return type

Union[int, float, None]

default_capacity_instance

The instance type to use for the default capacity.

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

default :default: m5.large

stability :stability: experimental

Return type

Optional[InstanceType]

default_capacity_type

The default capacity type for the cluster.

default :default: NODEGROUP

stability :stability: experimental

Return type

Optional[DefaultCapacityType]

endpoint_access

Configure access to the Kubernetes API server endpoint..

default :default: EndpointAccess.PUBLIC_AND_PRIVATE

see :see: https://docs.aws.amazon.com/eks/latest/userguide/cluster-endpoint.html stability :stability: experimental

Return type

Optional[EndpointAccess]

kubectl_enabled

We no longer allow disabling kubectl-support. Setting this option to false will throw an error.

To temporary allow you to retain existing clusters created with kubectlEnabled: false, you can use eks.LegacyCluster class, which is a drop-in replacement for eks.Cluster with kubectlEnabled: false.

Bear in mind that this is a temporary workaround. We have plans to remove eks.LegacyCluster. If you have a use case for using eks.LegacyCluster, please add a comment here https://github.com/aws/aws-cdk/issues/9332 and let us know so we can make sure to continue to support your use case with eks.Cluster. This issue also includes additional context into why this class is being removed.

default :default: true

deprecated :deprecated:

eks.LegacyCluster is temporarily provided as a drop-in replacement until you are able to migrate to eks.Cluster.

see :see: https://github.com/aws/aws-cdk/issues/9332 stability :stability: deprecated

Type

NOT SUPPORTED

Return type

Optional[bool]

kubectl_environment

Environment variables for the kubectl execution.

Only relevant for kubectl enabled clusters.

default :default: - No environment variables.

stability :stability: experimental

Return type

Optional[Mapping[str, str]]

masters_role

masters`` Kubernetes RBAC group.

default :default:

  • a role that assumable by anyone with permissions in the same account will automatically be defined

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

Type

An IAM role that will be added to the ``system

Return type

Optional[IRole]

output_cluster_name

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

default :default: false

stability :stability: experimental

Return type

Optional[bool]

output_config_command

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

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

default :default: true

stability :stability: experimental

Return type

Optional[bool]

output_masters_role_arn

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

default :default: false

stability :stability: experimental

Return type

Optional[bool]

role

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

default :default: - A role is automatically created for you

stability :stability: experimental

Return type

Optional[IRole]

security_group

Security Group to use for Control Plane ENIs.

default :default: - A security group is automatically created

stability :stability: experimental

Return type

Optional[ISecurityGroup]

version

The Kubernetes version to run in the cluster.

stability :stability: experimental

Return type

KubernetesVersion

vpc

The VPC in which to create the Cluster.

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

stability :stability: experimental

Return type

Optional[IVpc]

vpc_subnets

Where to place EKS Control Plane ENIs.

If you want to create public load balancers, this must include public subnets.

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

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
vpcSubnets: [
   { subnetType: ec2.SubnetType.Private }
]

default :default: - All public and private subnets

stability :stability: experimental

Return type

Optional[List[SubnetSelection]]