I am trying to deploy my EKS cluster using Python CDK. I am following this(https://github.com/pahud/aws-cdk-python-workshop/tree/master/Lab6) link for implementation. Everything is working good, but when I do 'cdk deploy', it is showing following error:
On Cloudformation console it is showing following error:
I tried changing version to 1.20, 1.20.4, 1.16, 1.16.5, etc(https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html) in cdk_pycon_eks_stack.py in following way,
...................
# create the cluster
cluster = aws_eks.Cluster(self, 'cluster',
masters_role=eks_admin_role,
vpc=vpc,
default_capacity=0,
version='1.20',
output_cluster_name=True
)
...........................................
, but then it shows following error:
Any help would be appreciated!! Thanks
Edit:
Additional images for reference in comments/Answers:
for version = aws_eks.KubernetesVersion.of("v1_20")
for version = aws_eks.KubernetesVersion().V1_20
The code here is looking for a full KubernetesVersion object, not a string.
Take a look at: https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_eks/KubernetesVersion.html#aws_cdk.aws_eks.KubernetesVersion
So you could do something like (forgive me this is untested, as I usually use TypeScript for CDK):
version = aws_eks.KubernetesVersion().V1_20
or maybe:
version = aws_eks.KubernetesVersion.of("v1_20") #string may be something else, try it and see
aws-cdk-lib-2.0.0rc7
to support Kubernetes version 1.20 on EKS # Create EKS cluster
self.eks_cluster = eks.Cluster(
scope=self, id='EKSDevCluster',
vpc=eks_private_vpc,
default_capacity=0,
cluster_name='eks-dev',
masters_role=eks_admin_role,
core_dns_compute_type=eks.CoreDnsComputeType.EC2,
version=eks.KubernetesVersion.V1_20,
role=node_role
)