Bug Description
even though the last resort is advertised to fall back to VPC-wide, it is actually trying to modify instances in the whole region, as there is no filter for the VPC:
|
// Get all running instances in the region |
|
input := &ec2.DescribeInstancesInput{ |
|
Filters: []types.Filter{ |
|
{ |
|
Name: aws.String("instance-state-name"), |
|
Values: []string{"running"}, |
|
}, |
|
}, |
|
} |
Additionally, the documentation lacks the permission ec2:ModifyInstanceMetadataOptions
Steps to Reproduce
- Install it
- See it attempting to reconfigure hop limit for whole region
Expected Behavior
To only modify resources that are part of the clusters
Actual Behavior
Luckily it fails due to missing IAM permissions
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
- Kubernetes version: 1.33
- Controller version: 1.3.8
- Installation method: Helm
Logs
2025-09-02T10:01:03Z DEBUG controllers.NodeENI.aws-ec2-client Looking up instance by private IP {"privateIP": "10.0.19.11"}
2025-09-02T10:01:03Z DEBUG controllers.NodeENI.aws-ec2-client Found private IP from network interface {"privateIP": "10.0.19.11", "interface": "eth0"}
2025-09-02T10:01:03Z DEBUG controllers.NodeENI.aws-ec2-client Found private IP from network interface {"privateIP": "10.0.19.11", "interface": "eth0"}
2025-09-02T10:01:03Z DEBUG controllers.NodeENI.aws-ec2-client Looking up instance by private IP {"privateIP": "10.0.19.11"
2025-09-02T10:01:03Z INFO controllers.NodeENI.aws-ec2-client Attempting VPC-wide IMDS configuration as last resort
2025-09-02T10:01:04Z INFO controllers.NodeENI.aws-ec2-client Configuring IMDS for instance {"instanceID": "i-08066b3a291eba64d", "hopLimit": 2}
2025-09-02T10:01:04Z INFO controllers.NodeENI.aws-ec2-client Updating IMDS hop limit for container compatibility {"instanceID": "i-08066b3a291eba64d", "currentHopLimit": 1, "newHopLimit": 2}
2025-09-02T10:01:04Z DEBUG controllers.NodeENI.aws-ec2-client Failed to configure IMDS for instance {"instanceID": "i-08066b3a291eba64d", "error": "failed to modify IMDS hop limit: failed to modify instance metadata options: operation error EC2: ModifyInstanceMetadataOptions, https response error StatusCode: 403, RequestID: e665f979-fcce-4949-858d-23eac6815171, api error UnauthorizedOperation: You are not authorized to perform this operation. User: arn:aws:sts::XX:assumed-roleaws-multi-eni/1756807256366945716 is not authorized to perform: ec2:ModifyInstanceMetadataOptions on resource: arn:aws:ec2:eu-west-1:XXX:instance/i-08066b3a291eba64d because no identity-based policy allows the ec2:ModifyInstanceMetadataOptions action. Encoded authorization failure message: ...."}
2025-09-02T10:01:04Z INFO controllers.NodeENI.aws-ec2-client Configuring IMDS for instance {"instanceID": "i-003daddd3e453fb72", "hopLimit": 2}
Bug Description
even though the last resort is advertised to fall back to VPC-wide, it is actually trying to modify instances in the whole region, as there is no filter for the VPC:
aws-multi-eni-controller/pkg/aws/ec2.go
Lines 1141 to 1149 in ebc2c8e
Additionally, the documentation lacks the permission
ec2:ModifyInstanceMetadataOptionsSteps to Reproduce
Expected Behavior
To only modify resources that are part of the clusters
Actual Behavior
Luckily it fails due to missing IAM permissions
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
Logs