Commit bf35178
authored
Grant ec2:DescribeSecurityGroups to the IPv6 VPC CNI role (#8837)
fix: Grant ec2:DescribeSecurityGroups to the IPv6 VPC CNI role
Subnet discovery in the VPC CNI needs two EC2 permissions, not one.
52148b4 granted ec2:DescribeSubnets; this grants the other half.
Reported in #8768, where an IPv6 cluster hit both denials in sequence.
The first surfaced as a MissingIAMPermissions pod event:
Unauthorized operation: failed to call ec2:DescribeSubnets due to
missing permissions.
Once that was granted the CNI got further and failed on the second,
which appears only in /var/log/aws-routed-eni/ipamd.log because the
container writes nothing about it to stdout:
Initialization failure: unable to describe security groups:
operation error EC2: DescribeSecurityGroups, StatusCode: 403,
api error UnauthorizedOperation: ... no identity-based policy
allows the ec2:DescribeSecurityGroups action
The upstream CNI documents both as required for subnet discovery since
v1.22.1, and subnet discovery is on by default:
aws/amazon-vpc-cni-k8s#3709
Only IPv6 clusters are affected. The IPv4 path attaches the AWS-managed
AmazonEKS_CNI_Policy, whose current version (v6) already grants both
ec2:DescribeSubnets and ec2:DescribeSecurityGroups. The IPv6 path uses
this hand-written inline policy instead, so each action has to be granted
explicitly.
Both callers of makeIPv6VPCCNIPolicyDocument are affected: the IRSA path
via addon.AttachPolicy, and the pod identity path via
PodIdentityAssociation.PermissionPolicy. The existing pod identity test
only asserted the document was non-empty, so it would not have caught a
missing action; it now asserts both subnet discovery permissions, as the
IRSA test already did for ec2:DescribeSubnets.
With this change the IPv6 policy matches the upstream IPv6 policy exactly,
with no missing and no extra actions.1 parent 8b60f9d commit bf35178
2 files changed
Lines changed: 17 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
498 | 500 | | |
| 501 | + | |
499 | 502 | | |
500 | 503 | | |
501 | 504 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
988 | 989 | | |
989 | 990 | | |
990 | 991 | | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
991 | 998 | | |
992 | 999 | | |
993 | 1000 | | |
| |||
1168 | 1175 | | |
1169 | 1176 | | |
1170 | 1177 | | |
1171 | | - | |
| 1178 | + | |
1172 | 1179 | | |
1173 | 1180 | | |
| 1181 | + | |
1174 | 1182 | | |
1175 | 1183 | | |
1176 | 1184 | | |
| |||
0 commit comments