spec.template.spec.nodeClassRef. Multiple NodePools can reference the same EC2NodeClass.
Full EC2NodeClass example
spec.amiSelectorTerms
AMI selector terms are required and configure which AMIs Karpenter uses. Terms are ORed together; conditions within a single term are ANDed.alias
Use analias to automatically select EKS-optimized AMIs. An alias is formatted as family@version.
Supported families:
al2al2023bottlerocketwindows2019windows2022windows2025
latest or pinned to a specific release:
An
alias term is mutually exclusive — it cannot be specified alongside other selector terms. When an alias is used, amiFamily is inferred automatically.Additional amiSelectorTerms examples
Additional amiSelectorTerms examples
Select by tag:Select by name with wildcard:Select by ID:Select by name and owner:Select using a custom SSM parameter:
When using a custom SSM parameter, expand the
ssm:GetParameter permissions on the Karpenter IAM role to include your parameter. The default policy only permits access to AWS public parameters.spec.amiFamily
Controls UserData generation and default block device mappings. Only required when not using analias in amiSelectorTerms (the alias infers the family automatically).
- AL2023
- AL2
- Bottlerocket
- Windows
- Custom
spec.subnetSelectorTerms
Selects which subnets Karpenter uses when launching instances. When launching nodes, Karpenter automatically chooses the subnet that matches the desired zone. If multiple subnets exist for a zone, the one with the most available IP addresses is used. Terms are ORed together; conditions within a single term are ANDed.Subnet selector examples
Subnet selector examples
Select by tag key:Select by name and tag:Select using multiple terms (OR):Select using wildcard:Select by ID:
spec.securityGroupSelectorTerms
Selects which security groups are attached to launched instances. Terms are ORed; conditions within a term are ANDed.When launching nodes, Karpenter attaches all security groups that match the selector. Avoid using the
kubernetes.io/cluster/$CLUSTER_NAME tag for discovery — it may cause failures with the AWS Load Balancer controller, which only supports a single security group with that tag key. Use karpenter.sh/discovery: $CLUSTER_NAME instead.spec.role and spec.instanceProfile
You must specify exactly one ofrole or instanceProfile.
The IAM role name for node identity. Karpenter will manage the instance profile on your behalf.
A pre-provisioned IAM instance profile. Karpenter will not manage this profile — you must create it and assign a role to it yourself.
For private clusters without public internet access,
spec.instanceProfile is required. IAM doesn’t support private VPC endpoints, so spec.role cannot be used in that context.spec.kubelet
Optional kubelet configuration applied to all nodes using this EC2NodeClass.If you need to configure a kubelet field not exposed in
spec.kubelet, set it via spec.userData. For example, to configure maxPods and registryPullQPS on AL2023:Pods per core and max pods
Pods per core and max pods
podsPerCore calculates max pod density dynamically by multiplying the value by the number of vCPUs. It’s also passed to
--pods-per-core on kubelet startup.maxPods overrides the default pod density limit. Useful for small instances needing higher density or large instances needing lower density. Consider enabling prefix assignment mode for small instance types.When both are set, the minimum of podsPerCore-derived density and maxPods is used.Reserved resources
Reserved resources
Karpenter automatically configures system and kube reserved resources. Override the defaults with:
Eviction thresholds
Eviction thresholds
Configure hard and soft eviction thresholds:
| Signal | Description |
|---|---|
memory.available | node.status.capacity[memory] - node.stats.memory.workingSet |
nodefs.available | node.stats.fs.available |
nodefs.inodesFree | node.stats.fs.inodesFree |
imagefs.available | node.stats.runtime.imagefs.available |
imagefs.inodesFree | node.stats.runtime.imagefs.inodesFree |
pid.available | node.stats.rlimit.maxpid - node.stats.rlimit.curproc |
spec.blockDeviceMappings
Controls the EBS volumes attached to provisioned nodes. Karpenter uses AMIFamily-specific defaults when not specified.Default block device mappings by AMI family
Default block device mappings by AMI family
AL2 / AL2023:Bottlerocket:Windows2019 / Windows2022 / Windows2025:Custom: No default block device mappings.
spec.metadataOptions
Controls exposure of the Instance Metadata Service (IMDS) on launched instances. Defaults:spec.tags
Propagates additional tags to all EC2 resources Karpenter creates (instances, EBS volumes, launch templates). Default tags added by Karpenter:You can override the default
Name tag, but overriding restricted tag domains (karpenter.sh, karpenter.k8s.aws, kubernetes.io/cluster) is not allowed.spec.userData
Custom scripts or configuration to pass to nodes at startup. Karpenter merges your UserData with its generated defaults based on AMIFamily.spec.instanceStorePolicy
Controls how instance-store volumes are handled. By default, they are ignored. Set toRAID0 to use instance-store volumes for faster node ephemeral storage:
spec.detailedMonitoring
Enables EC2 detailed monitoring, which provides 1-minute CloudWatch metrics.spec.ipPrefixCount
Sets the number of IPv4 (or IPv6, for IPv6 clusters) prefixes assigned to the network interface of each launched instance. When configured, Karpenter can schedule more pods per node by using IP prefix delegation. See the EC2 Launch Template Network Interface Spec for details.When using
spec.associatePublicIPAddress: true with EFA workloads that request multiple EFA resources, the instance will fail to launch — EC2 requires a single ENI when setting associatePublicIPAddress. Segregate EFA workloads into a separate NodePool/EC2NodeClass pair.spec.capacityReservationSelectorTerms
This field is in Beta.
status
| Field | Description |
|---|---|
status.subnets | Resolved subnets (sorted by available IP count, descending) |
status.securityGroups | Resolved security groups |
status.amis | Resolved AMIs with architecture requirements |
status.capacityReservations | Resolved capacity reservations |
status.instanceProfile | Instance profile generated from spec.role |
status.conditions | Readiness conditions |
Status conditions
| Condition | Description |
|---|---|
SubnetsReady | Subnets discovered successfully |
SecurityGroupsReady | Security groups discovered successfully |
InstanceProfileReady | Instance profile discovered successfully |
AMIsReady | AMIs discovered successfully |
Ready | All conditions true; NodePools referencing this class are considered for scheduling |