EKS cluster creation error with cdk

0

Hi There I am trying to use cdk to deploy my k8s container application with cdk and cloudformation, but I am getting provisioning errors and I am finding it hard to troubleshoot. Could someone help me ?

Embedded stack arn:aws:cloudformation:ca-central-1:093271843966:stack/ClusterStack-awscdkawseksClusterResourceProviderNestedStackawscdkawseksClusterResource-19M07RHIYOID7/c7daa770-54ba-11ee-b80a-02211b27520e was not successfully created: The following resource(s) failed to create: [OnEventHandler42BEBAE0, IsCompleteHandler7073F4DA].

The following resource(s) failed to create: [awscdkawseksClusterResourceProviderNestedStackawscdkawseksClusterResourceProviderNestedStackResource9827C454]. Rollback requested by user.

This is also my cluster_stacker.py file

from aws_cdk import core as cdk from aws_cdk import aws_iam as iam from aws_cdk import aws_eks as eks from aws_cdk import aws_ec2 as ec2

class ClusterStack(cdk.Stack):

def __init__(self, scope: cdk.Construct, construct_id: str, **kwargs) -> None:
    super().__init__(scope, construct_id, **kwargs)

    # Look up the default VPC
    vpc = ec2.Vpc.from_lookup(self, id="VPC", is_default=True)

    # Create master role for EKS Cluster
    iam_role = iam.Role(self, id=f"{construct_id}-iam",
                        role_name=f"{construct_id}-iam", assumed_by=iam.AccountRootPrincipal())

    # Creating Cluster with EKS
    eks_cluster = eks.Cluster(
        self, id=f"{construct_id}-cluster",
        cluster_name=f"{construct_id}-cluster",
        vpc=vpc,
        vpc_subnets=vpc.public_subnets,
        masters_role=iam_role,
        default_capacity_instance=ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO),
        version=eks.KubernetesVersion.V1_20,
    )

Also getting this nodejs error Resource handler returned message: "The runtime parameter of nodejs12.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs18.x)

1 Answer
0

Hello,

Your Lambda should not be set to use nodejs.12x. Recommendation is use the new runtime (nodejs18.x). Did you update aws-cdk-lib?. You probably need to upgrade to CDKBuild-4.x

Please, accept this answer if it was useful to you.

Thank you.

profile pictureAWS
ladybug
answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions