Feature: Disable hyperthreading via EC2NodeClass cpuOptions.threadsPerCore
Description
What problem are you trying to solve?
We want to run some workloads on nodes with simultaneous multithreading (hyperthreading) disabled: software licensed per vCPU (AWS now offers optimized CPU options for license-included instances, https://aws.amazon.com/about-aws/whats-new/2025/10/amazon-ec2-cpu-options-optimization-license-included-instances/), latency-sensitive services that should not share a physical core, and hardening against the class of side-channel attacks that cross SMT siblings.
EC2 supports this at launch through CpuOptions.ThreadsPerCore=1, but there is no way to request it from an EC2NodeClass. Disabling SMT from user data at boot is possible today, but then Karpenter keeps scheduling against the instance type's default vCPU count: a pod sized for 8 vCPUs gets a c6i.2xlarge that boots with 4, and the node is either unschedulable for that pod or overcommitted until the kubelet's real capacity is observed.
spec.cpuOptions was added in #9043 for nested virtualization. That PR deliberately left threadsPerCore out because the core count EC2 requires alongside it is a property of each instance type, and a hardcoded value would silently shrink the candidate pool. This request is for that follow-up: threadsPerCore only, with Karpenter deriving the core count per instance type.
This was previously requested in #6092, which was closed into #3369; #3369 was closed on 2026-09-04 with a request to open per-feature issues instead. #8844 is an open PR that passes coreCount and threadsPerCore through statically.
How important is this feature to you?
Important: it blocks moving these workloads onto Karpenter-managed capacity.
I have an implementation ready that:
- adds
spec.cpuOptions.threadsPerCore(1 or 2); - resolves the core count per instance type from
DescribeInstanceTypes(DefaultCores), so NodePool diversity is preserved and mixed Graviton/x86 pools work (Graviton already runs one thread per core and launches unchanged); - computes capacity, kube-reserved, podsPerCore, the CEL
vcpusvariable and theinstance-cpulabel from the launched vCPU count, so NodeClaim capacity matches what the kubelet reports; - excludes instance types that can't run the requested value (per
ValidThreadsPerCore/ValidCores) during instance type resolution, the same way nested virtualization does.
It has been verified on a live cluster (default unchanged; threadsPerCore: 1 giving CoreCount=2/ThreadsPerCore=1 on c6i.xlarge with NodeClaim and kubelet capacity both 2; drift in both directions; a mixed c6i/c6g pool; and identical 3-vCPU pods selecting c6i.2xlarge vs c6g.xlarge).
PR is opened: #9629
Source: aws/karpenter-provider-aws