Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_eks: no matches for kind "CronJob" in v ersion "batch/v1beta1"\n' #25027

Closed
badaldavdatcpl opened this issue Apr 11, 2023 · 2 comments
Closed
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug. duplicate This issue is a duplicate.

Comments

@badaldavdatcpl
Copy link

badaldavdatcpl commented Apr 11, 2023

Describe the bug

On deploying karpenter using cdk-eks-karpenter

it is failing.

Expected Behavior

It should work as expected.

Current Behavior

Failure -

Received response status [FAILED] from custom resource. Message returned: Error: b'configmap/aws-auth configured\nerror: error retrieving RESTMappings to prune: invalid resource batch/v1beta1, Kind=CronJob, Namespaced=true: no matches for kind "CronJob" in version "batch/v1beta1"\n' Logs: /aws/lambda/MyEksBlueprintStack-awscdkawseksKu-Handler886CB40B-ni5iL3nrGKLh at invokeUserFunction (/var/task/framework.js:2:6) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async onEvent (/var/task/framework.js:1:369) at async Runtime.handler (/var/task/cfn-response.js:1:1573) (RequestId: 3e005095-b49f-4135-9dac-d561dd7d1528)

Reproduction Steps

from aws_cdk import (
    # Duration,
    Stack,
    # aws_sqs as sqs,
    aws_eks as eks,
    aws_ec2 as ec2,
    aws_iam as iam
)

from cdk_eks_karpenter import Karpenter
from constructs import Construct

class MyEksBlueprintsStack(Stack):

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

        vpc = ec2.Vpc(self, 'EKS-CDK-VPC', cidr='10.0.0.0/16', nat_gateways=1)
        eks_admin_role = iam.Role(self, 'AdminRole',
                                      assumed_by=iam.AccountPrincipal(
                                          account_id=self.account))

        cluster = eks.Cluster(self, "hello-eks",
        version=eks.KubernetesVersion.V1_25, vpc=vpc, masters_role=eks_admin_role, output_cluster_name=True, default_capacity=0
        )

        cluster.add_nodegroup_capacity('ondemand', instance_types=[ec2.InstanceType('t3.large')],
                             min_size=1,
                             max_size=1
        )

        # apply a kubernetes manifest to the cluster
        cluster.add_manifest("mypod", {
            "apiVersion": "v1",
            "kind": "Pod",
            "metadata": {"name": "mypod"},
            "spec": {
                "containers": [{
                    "name": "hello",
                    "image": "paulbouwer/hello-kubernetes:1.5",
                    "ports": [{"containerPort": 8080}]
                }
                ]
            }
        })

        karpenter = Karpenter(self, "karpenter", cluster=cluster)

        provisioner_spec = {
        'requirements': [{
            'key': 'karpenter.sh/capacity-type',
            'operator': 'In',
            'values': ['spot']
        }],
        'limits': {
            'resources': {
            'cpu': 20
            }
        },
        'provider': {
            'subnetSelector': {
            'Name': 'PublicSubnet*'
            },
            'securityGroupSelector': {
            'aws:eks:cluster-name': cluster.cluster_name
            
            }
        }
        }

        karpenter.add_provisioner('spot-provisioner',provisioner_spec=provisioner_spec)

Possible Solution

Remove CronJob from v1.25 since it is deprecated

Additional Information/Context

https://kubernetes.io/docs/reference/using-api/deprecation-guide/#cronjob-v125

CDK CLI Version

2.73.0

Framework Version

No response

Node.js Version

19.7.0

OS

macOS

Language

Python

Language Version

3.11.1

Other information

Kubernetes v1.25
cdk-eks-karpenter>=0.0.27
aws-cdk-lib==2.73.0

@badaldavdatcpl badaldavdatcpl added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 11, 2023
@github-actions github-actions bot added the @aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service label Apr 11, 2023
@peterwoodworth
Copy link
Contributor

I believe this is the issue you are looking for 🙂 Let's take further discussion there if this doesn't work for you

@peterwoodworth peterwoodworth added duplicate This issue is a duplicate. bug This issue is a bug. and removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 12, 2023
@peterwoodworth peterwoodworth closed this as not planned Won't fix, can't repro, duplicate, stale Apr 12, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug. duplicate This issue is a duplicate.
Projects
None yet
Development

No branches or pull requests

2 participants