Giter Club home page Giter Club logo

cdk-eks-karpenter's Introduction

cdk-eks-karpenter

This construct configures the necessary dependencies and installs Karpenter on an EKS cluster managed by AWS CDK.

Prerequisites

Usage with EC2 Spot Capacity

If you have not used EC2 spot in your AWS account before, follow the instructions here to create the service linked role in your account allowing Karpenter to provision EC2 Spot Capacity.

Using

In your CDK project, initialize a new Karpenter construct for your EKS cluster, like this:

const cluster = new Cluster(this, 'testCluster', {
  vpc: vpc,
  role: clusterRole,
  version: KubernetesVersion.V1_27,
  defaultCapacity: 1
});

const karpenter = new Karpenter(this, 'Karpenter', {
  cluster: cluster
});

This will install and configure Karpenter in your cluster. To have Karpenter do something useful, you also need to create an EC2NodeClass and an NodePool, for a more complete example, see test/integ.karpenter.ts.

Known issues

Versions earlier than v0.6.1 fails to install

As of aws/karpenter#1145 the Karpenter Helm chart is refactored to specify clusterEndpoint and clusterName on the root level of the chart values, previously these values was specified under the key controller.

Testing

This construct adds a custom task to projen, so you can test a full deployment of an EKS cluster with Karpenter installed as specified in test/integ.karpenter.ts by running the following:

export CDK_DEFAULT_REGION=<aws region>
export CDK_DEFAULT_ACCOUNT=<account id>
npx projen test:deploy

As the above will create a cluster without EC2 capacity, with CoreDNS and Karpenter running as Fargate pods, you can test out the functionality of Karpenter by deploying an inflation deployment, which will spin up a number of pods that will trigger Karpenter creation of worker nodes:

kubectl apply -f test/inflater-deployment.yml

You can clean things up by deleting the deployment and the CDK test stack:

kubectl delete -f test/inflater-deployment.yml
npx projen test:destroy

FAQ

I'm not able to launch spot instances

  1. Ensure you have the appropriate linked role available in your account, for more details, see the karpenter documentation

cdk-eks-karpenter's People

Contributors

andskli avatar dependabot[bot] avatar zorrofox avatar badaldavdatcpl avatar badaldavda8 avatar plumdog avatar r-arek avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.