Skip to content

Karpenter creates hundreds of InstanceProfiles #8838

@varun-armis

Description

@varun-armis

Description

Observed Behavior:

Karpenter will create hundreds of "zombie" instance profiles that caused us to reach our AWS Quota and we started seeing reconciler errors

{"level":"ERROR","time":"2025-12-31T08:27:43.178Z","logger":"controller","caller":"controller/controller.go:474","message":"Reconciler error","commit":"c9c3a48","controller":"nodeclass","controllerGroup":"karpenter.k8s.aws","controllerKind":"EC2NodeClass","EC2NodeClass":{"name":"sandbox-x86"},"namespace":"","name":"sandbox-x86","reconcileID":"daa53858-4bd7-4456-848b-29345886c3de","aws-operation-name":"CreateInstanceProfile","aws-request-id":"9d5f627e-3e35-4711-9021-c9f5b │ │ e5746d7","aws-service-name":"IAM","aws-status-code":409,"instance-profile":"frstg2_4574861420783301831","error":"creating instance profile, operation error IAM: CreateInstanceProfile, https response error StatusCode: 409, RequestID: 9d5f627e-3e35-4711-9021-c9f5be5746d7, LimitExceeded: Cannot exceed quota for InstanceProfilesPerAccount: 1000 (aws-operation-name=CreateInstanceProfile, aws-request-id=9d5f627e-3e35-4711-9021-c9f5be5746d7, aws-service-name=IAM, aws-status-cod │ │ e=409) (instance-profile=frstg2_4574861420783301831)"}

We realized that we had 2 misconfigurations. First, we were accidentally applying resource filtering on our ListIamInstanceProfiles policy (which is not supported: https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsidentityandaccessmanagementiam.html) that was attached to the Karpenter controller. Second, we were also using the IAM Role ARN instead of name in all of our EC2NodeClasses

Expected Behavior:

According to this (instanceprofile.go) it seems like using the ARN of the IAM Role in the EC2NodeClass shouldn't actually be supported yet we've been running Karpenter with the Role ARN for several months. It seems like the fix should either be to support the ARN or display an error when the ARN is used for the role.

Reproduction Steps (Please include YAML):

  1. Set the role for the EC2NodeClass to the ARN of the IAM Role instead of the name of the IAM Role.
  2. Do not attach the ListIamInstanceProfiles permission to the Karpenter controller

Versions:

  • Chart Version: 1.8.3
  • Kubernetes Version (kubectl version): 1.33
  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Metadata

Metadata

Labels

bugSomething isn't workingpriority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next release.triage/acceptedIndicates that the issue has been accepted as a valid issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions