-
I created 2 nodePools:
Test workload: apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: karpenter-test
name: karpenter-test
namespace: karpenter-test
spec:
replicas: 2
selector:
matchLabels:
app: karpenter-test
strategy: {}
template:
metadata:
labels:
app: karpenter-test
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: kubernetes.io/hostname
namespaces:
- karpenter-test
labelSelector:
matchLabels:
app: karpenter-test
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app: karpenter-test
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app: karpenter-test
# - maxSkew: 1
# topologyKey: capacity-spread
# whenUnsatisfiable: ScheduleAnyway
# labelSelector:
# matchLabels:
# app: karpenter-test
tolerations:
- key: label
value: karpenter1
effect: NoSchedule
nodeSelector:
label: karpenter1
containers:
- image: nginx
name: nginx
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: karpenter-test
namespace: karpenter-test
spec:
maxUnavailable: 1
selector:
matchLabels:
app: karpenter-test
unhealthyPodEvictionPolicy: AlwaysAllow I explicitly commented out Karpenter version: 1.2.1 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Karpenter will choose the compatible NodePool with the highest weight. If there are multiple compatible NodePools with equal weight, there is no formal guarantee which Karpenter will choose. Currently, it selects the first NodePool based on alphabetical order, but this is an implementation detail and could change in the future. I wouldn't rely on this behavior. |
Beta Was this translation helpful? Give feedback.
Karpenter will choose the compatible NodePool with the highest weight. If there are multiple compatible NodePools with equal weight, there is no formal guarantee which Karpenter will choose. Currently, it selects the first NodePool based on alphabetical order, but this is an implementation detail and could change in the future. I wouldn't rely on this behavior.