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

karpenter addon: cannot get nodeclaims #1067

Open
montanaflynn opened this issue Aug 23, 2024 · 0 comments
Open

karpenter addon: cannot get nodeclaims #1067

montanaflynn opened this issue Aug 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@montanaflynn
Copy link

Describe the bug

After setting up a kubernetes cluster using the example in https://aws-quickstart.github.io/cdk-eks-blueprints/addons/karpenter/ I cannot do the following:

$ kubectl get nodeclaims
Error from server: conversion webhook for karpenter.sh/v1beta1, Kind=NodeClaim failed: Post "https://karpenter.kube-system.svc:8443/?timeout=30s": no service port 8443 found for service "karpenter"

The interesting thing is also that the blueprint addon sets up karpenter in karpenter namespace, not kube-system

Expected Behavior

Able to view nodeclaims using kubectl get nodeclaims

Current Behavior

$ kubectl get nodeclaims
Error from server: conversion webhook for karpenter.sh/v1beta1, Kind=NodeClaim failed: Post "https://karpenter.kube-system.svc:8443/?timeout=30s": no service port 8443 found for service "karpenter"

Reproduction Steps

import 'source-map-support/register';
import * as cdk from 'aws-cdk-lib';
import * as iam from "aws-cdk-lib/aws-iam";
import * as eks from "aws-cdk-lib/aws-eks";
import * as blueprints from '@aws-quickstart/eks-blueprints';
import { KubernetesVersion } from 'aws-cdk-lib/aws-eks';

const app = new cdk.App();
const blueprintID = "test-blueprint-stack"
const region = "us-west-1"

const karpenterAddOn = new blueprints.addons.KarpenterAddOn({
  version: 'v0.37.2',
  nodePoolSpec: {
    labels: {
      type: "karpenter-test"
    },
    annotations: {
      "eks-blueprints/owner": "platform-team"
    },
    requirements: [
      { key: 'node.kubernetes.io/instance-type', operator: 'In', values: ['m5.large'] },
      { key: 'topology.kubernetes.io/zone', operator: 'In', values: [`${region}a`, `${region}c`] },
      { key: 'kubernetes.io/arch', operator: 'In', values: ['amd64', 'arm64'] },
      { key: 'karpenter.sh/capacity-type', operator: 'In', values: ['on-demand'] }, // spot is also supported for cost savings, please see #2 above
    ],
    disruption: {
      consolidationPolicy: "WhenEmpty",
      consolidateAfter: "30s",
      expireAfter: "20m",
      // budgets: [{nodes: "10%"}] // budgets are supported in versions 0.34+
    }
  },
  ec2NodeClassSpec: {
    amiFamily: "AL2",
    subnetSelectorTerms: [{ tags: { "Name": `${blueprintID}/${blueprintID}-vpc/PrivateSubnet*` } }],
    securityGroupSelectorTerms: [{ tags: { "aws:eks:cluster-name": `${blueprintID}` } }],
  },
  interruptionHandling: true,
  podIdentity: false, // Recommended true if using version 0.35+; otherwise, set false (as default) to use IRSA.
});

const blueprint = blueprints.EksBlueprint.builder()
  .version(KubernetesVersion.V1_30)
  .region(region)
  .addOns(karpenterAddOn)
  .build(app, blueprintID);

const eksCluster: eks.Cluster = blueprint.getClusterInfo().cluster as eks.Cluster;
const clusterUsers = ["montana"]
for (const user of clusterUsers) {
  eksCluster.awsAuth.addUserMapping(iam.User.fromUserName(eksCluster, user, user), { username: user, groups: ['system:masters'] })
}

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.147.3 (build 32f0fdb)

EKS Blueprints Version

1.15.1

Node.js Version

v22.5.1

Environment details (OS name and version, etc.)

macOS 14.6.1 (23G93)

Other information

No response

@montanaflynn montanaflynn added the bug Something isn't working label Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant