I'm in the process of switching from Managed Nodegroups to Karpenter for my AWS setup. In my Managed Nodegroups, I was able to use arbitrary labels to prevent any interference between pods. Now, I'm trying to replicate that with Karpenter, but I'm running into some issues.
Here's the Nodepool I've created:
```yaml
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
name: trino
spec:
disruption:
budgets:
- nodes: 10%
consolidateAfter: 30s
consolidationPolicy: WhenEmptyOrUnderutilized
template:
spec:
expireAfter: 720h
nodeClassRef:
group: karpenter.k8s.aws
kind: EC2NodeClass
name: default
requirements:
- key: randomthing.io/dedicated
operator: In
values:
- trino
- key: kubernetes.io/arch
operator: In
values:
- amd64
- key: karpenter.k8s.aws/instance-category
operator: In
values:
- m
- key: karpenter.k8s.aws/instance-cpu
operator: In
values:
- "8"
- key: karpenter.k8s.aws/instance-memory
operator: In
values:
- "16384"
taints:
- key: randomthing.io/dedicated
value: trino
effect: NoSchedule
labels:
provisioner: karpenter
randomthing.io/dedicated: trino
weight: 10
```
However, when I attempt to create a pod with the appropriate tolerations and node selectors, I get an error: `label "randomthing.io/dedicated" does not have known values`. Is there a specific step that I might be missing to get this working?
2 Answers
It looks like you're placing the labels in the wrong section. You need to define your labels under `spec.template.metadata.labels`. That's the correct location for node labels in Karpenter.
Absolutely! The labels should be in `spec.template.metadata.labels` as well. Make sure you check that spot, as it’s always crucial to have the correct paths when dealing with configurations.
I checked it, but it's still giving me that error when I try to create the pod.

I've tried putting the labels there, but I'm still encountering the same error.