<p>I am trying to deploy my EKS cluster using Python CDK. I am following this(<a href="https://github.com/pahud/aws-cdk-python-workshop/tree/master/Lab6" rel="nofollow noreferrer">https://github.com/pahud/aws-cdk-python-workshop/tree/master/Lab6</a>) link for implementation.
Everything is working good, but when I do 'cdk deploy', it is showing following error:
<a href="https://i.stack.imgur.com/SBip0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SBip0.png" alt="enter image description here" /></a></p>
<p>On Cloudformation console it is showing following error:</p>
<p><a href="https://i.stack.imgur.com/qmS7I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qmS7I.png" alt="enter image description here" /></a></p>
<p>I tried changing version to 1.20, 1.20.4, 1.16, 1.16.5, etc(<a href="https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html</a>) in <strong>cdk_pycon_eks_stack.py</strong> in following way,</p>
<pre><code>...................

# 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
                                  )

...........................................
</code></pre>
<p>, but then it shows following error:</p>
<p><a href="https://i.stack.imgur.com/1XHTA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1XHTA.png" alt="enter image description here" /></a></p>
<p>Any help would be appreciated!!
Thanks</p>
<hr />
<p>Edit:</p>
<p>Additional images for reference in comments/Answers:
for <code>version = aws_eks.KubernetesVersion.of(&quot;v1_20&quot;)</code>
<a href="https://i.stack.imgur.com/hMHjU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hMHjU.png" alt="enter image description here" /></a></p>
<p>for <code>version = aws_eks.KubernetesVersion().V1_20</code></p>
<p><a href="https://i.stack.imgur.com/keK2j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/keK2j.png" alt="enter image description here" /></a></p>

Hetul Sheth
<ul>
<li>First, you need <code>aws-cdk-lib-2.0.0rc7</code> to support Kubernetes version 1.20 on EKS</li>
<li>Then follow the post <a href="https://dev.to/vumdao/using-iam-service-account-instead-of-instance-profile-for-eks-pods-262p" rel="nofollow noreferrer">https://dev.to/vumdao/using-iam-service-account-instead-of-instance-profile-for-eks-pods-262p</a> to up your EKS cluster with IAM service account</li>
<li>Snippet:</li>
</ul>
<pre><code>        # 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
        )
</code></pre>
