-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix missing permission setup for IPv6 cluster #8387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d9ad15f
to
41355da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the CR and issue report! The functionality looks good -- tested on my machine and it seems to be working great. Just left a couple small suggestions/questions on the docs.
# "ec2:AssignIpv6Addresses" would be required for IPv6 cluster | ||
# - https://github.com/aws/amazon-vpc-cni-k8s/blob/master/docs/iam-policy.md#ipv6-mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the other policies required as well? The comment makes it sound a bit like "ec2:AssignIpv6Addresses"
might be the only required action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I have traced the code, IPv4/IPv4 have different IAM policy set, so they are completely different. For example, IPv6 mode does not required AssignIPv4/UnadsignIPv4 permission (and by current design, it doesn't need UnassignIPv6 as well).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just search around the code once again, I found it already had makeIPv6VPCCNIPolicyDocument()
...
Umm... 🤔
eksctl/pkg/actions/addon/create.go
Lines 474 to 498 in fbfeda6
func makeIPv6VPCCNIPolicyDocument(partition string) map[string]interface{} { | |
return map[string]interface{}{ | |
"Version": "2012-10-17", | |
"Statement": []map[string]interface{}{ | |
{ | |
"Effect": "Allow", | |
"Action": []string{ | |
"ec2:AssignIpv6Addresses", | |
"ec2:DescribeInstances", | |
"ec2:DescribeTags", | |
"ec2:DescribeNetworkInterfaces", | |
"ec2:DescribeInstanceTypes", | |
}, | |
"Resource": "*", | |
}, | |
{ | |
"Effect": "Allow", | |
"Action": []string{ | |
"ec2:CreateTags", | |
}, | |
"Resource": fmt.Sprintf("arn:%s:ec2:*:*:network-interface/*", partition), | |
}, | |
}, | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's a logic error so that makeIPv6VPCCNIPolicyDocument()
not being called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting -- looks like that's only applied if the cluster config has either autoApplyPodIdentityAssociations
or useDefaultPodIdentityAssociations
set (code).
EKS Add-ons also support receiving IAM permissions via EKS Pod Identity Associations. The config file exposes three fields that allow configuring these:
addon.podIdentityAssociations
,addonsConfig.autoApplyPodIdentityAssociations
andaddon.useDefaultPodIdentityAssociations
. You can either explicitly configure the desired pod identity associations, usingaddon.podIdentityAssociations
, or have eksctl automatically resolve (and apply) the recommended pod identity configuration, using eitheraddonsConfig.autoApplyPodIdentityAssociations
oraddon.useDefaultPodIdentityAssociations
.
That being said, I think your docs change is still correct -- the example you're changing is for a cluster with IPv6, and not using pod identity, right?
We could also change the code logic to auto-apply these permissions, but I think updating the docs here is good for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, should be still valid ClusterConfig.
Actually, I've created an issue before the PR here. Maybe we could track issue there, and merge the PR here first ( to avoid incoming issue report for the missing permission issue ).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer to have another PR to fix the code logic issue, as it might need more test cases for CloudFormation Template generate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! I'll go ahead and approve/merge this PR then. Thanks for the contribution!
41355da
to
a0cd646
Compare
Description
While
useDefaultPodIdentityAssociations: true
set, eksctl will only attached AmazonEKS_CNI_Policy to the IAM role for the CNI, however AmazonEKS_CNI_Policy is not designed for IPv6 cluster (missingec2:AssignIpv6Addresses
permission). Ref: IAM requirements for IPv6 cluster.Additionally, to support IPv6 cluster, the
ClusterConfig
need to configure vpc-cni withIRSA mode
but notPodIdentity
, since the current design,attachPolicy
association currently not compatible withuseDefaultPodIdentityAssociations: true
.The PR here attempts to do a quick fix of IPv6 cluster with simplest way, the doc fix only.
To made
attachPolicy
works withuseDefaultPodIdentityAssociations: true
may requires tons of code work, so, let's first keep it simple with doc changes only.Before Fix:

After Fix:

Checklist
README.md
, or theuserdocs
directory)area/nodegroup
) and kind (e.g.kind/improvement
)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯