- Newest
- Most votes
- Most comments
You're correct that Karpenter doesn't use the concept of node groups like traditional EKS managed node groups. The suggestion to use "eks.amazonaws.com/nodegroup-name" as a label wouldn't work as expected with Karpenter.
To customize the node names for Karpenter-provisioned nodes, you'll need to use Karpenter's own naming conventions and configuration options. Karpenter allows you to specify a custom naming pattern for the EC2 instances it creates, which in turn affects the node names in Kubernetes.
You can achieve this by modifying the Karpenter Provisioner (or NodePool in newer versions) configuration. In the Provisioner/NodePool spec, you can use the "aws" section to define a custom naming pattern. Here's an example of how you might structure it:
spec: aws: tags: Name: "{{.Project}}-{{.Application}}-{{.Environment}}-{{.ClusterVersion}}-{{.InstanceID}}"
In this pattern, you would replace the placeholders (like {{.Project}}, {{.Application}}, etc.) with actual values or references to labels/annotations that Karpenter can interpret.
Keep in mind that the exact node name in Kubernetes might still include some AWS-specific information (like the IP address and region), but the EC2 instance name will follow your specified pattern. This approach allows you to have more meaningful and project-specific names for your Karpenter-managed nodes while still working within Karpenter's architecture.
Remember to test this configuration in a non-production environment first to ensure it works as expected with your specific setup and requirements.
Sources
EKS Node Scaling with Karpenter | AWS re:Post
Karpenter - Amazon EKS
answered 2 years ago
I use tag to name the instances
apiVersion: karpenter.k8s.aws/v1
kind: EC2NodeClass
...
tags:
Name: my-karpenter-node
answered 2 years ago
I think you can use something like this
apiVersion: karpenter.sh/v1alpha5
kind: Provisioner
metadata:
name: default
spec:
# ...existing code...
requirements:
- key: "karpenter.sh/capacity-type"
operator: In
values: ["spot", "on-demand"]
provider:
# ...existing code...
kubeletConfiguration:
kubeletExtraArgs:
hostname-override: "<project-name><application-name>-<env-name>-<cluster-version>"
# ...existing code...
Ensure that the values you use for hostnam-override are unique and valid DNS names
Relevant content
asked 3 years ago
asked a year ago
