-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Support for creating service accounts with IAM policy #525
Comments
Hi @msvticket In that example, you are essentially just moving 2 resources into this module ( I get the idea but I think it makes more sense to just create your own module to do this. Feel free to convince me otherwise 😄 |
It would be nice to include a complete example in this module. Maybe we can leverage autoscaler and expose it under default serviceAccounts but different iam role than worker. |
May be a lot of people don't know the context of this feature request : Indeed, this feature has been released since EKS k8s 1.13 AnnouncementAmazon EKS Adds Support to Assign IAM Permissions to Kubernetes Service Accounts AWS Docs |
Yes I think this would be a good idea. Include an example of creating an IAM role and policy to use for the cluster-autoscaler. And also remove the autoscaling policy from the worker group. |
Agreed on the autoscaling example with one caveat - we should hold off on that particular one until cluster-autoscaler actually supports it :) They need to update their AWS SDK in order to do so: |
Agreed with @dcherman. For now, only the autoscaler's master branch has been updated, see kubernetes/autoscaler#2323 (so for Kubernetes 1.16). For autoscaler which is compatible with Kubernetes 1.13 and 1.14 here the PR
In short, it doesn't work on EKS for now. |
FYI, it sounds like it's now backported into 1.13 and 1.14 kubernetes/autoscaler#2301 (comment) |
For anyone interested, I've extended the terraform-aws-iam module to setup the IAM role and assume role policies. Edit: |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This would be really nice to have and to provide an example for how to do it with the cluster-autoscaler now. cluster-autoscaler now supports it in 1.14.6? I am interested and could work on this one. |
Some support for IRSA addied in the v8.0.0 release https://github.com/terraform-aws-modules/terraform-aws-eks/releases/tag/v8.0.0 |
I'm still not convinced we want to manage IAM roles and policy in the core of this module. You could perhaps add a separate module under /modules but is it really that complicated? People can just manage IAM stuff elsewhere in their TF code base? |
Yeah I have an iam.tf file next to eks.tf which works great. A guide to enable and migrate to IRSA would be great if the support is at that stage. |
100%. We'll make an example or accept a PR for this. TBH I'm not sure the amazon-eks-pod-identity-webhook thing is ready. We've been waiting months for official docker images and today I tried their installation approach and hit some issues aws/amazon-eks-pod-identity-webhook#33 |
But the webhook is built in to EKS for 1.14 and 1.13 clusters created or upgraded after September 3rd. You don't need to run anything extra. I've gone through the painful process of migrating from kube2iam to OIDC on a live cluster. |
Not even the
What is serving that? The EKS service? |
It's all hidden away out of sight. I'm guessing on the master nodes? You can spin up a new cluster and annotate a ServiceAccount with the necessary |
Thank you. It appears I skim read the documentation and the AWS announcements a missed some vital information 😅I did think it was somewhat lazy of AWS not to run this thing themselves.... Anyway, looking at creating an example for the cluster-autoscaler, and I see there's these resources required:
And the required data for these resources:
What do you think about creating a module for this? |
Can be with just 2 resources:
Per https://www.terraform.io/docs/providers/aws/r/iam_role_policy.html |
Sure but it looks ugly 💅 |
Would really appreciate an example for the Since the ServiceAccount abstraction is a Kubernetes concept, it would be really nice to have some examples in here on how to do it, especially with the OICD provider. Spent last year working with GKE clusters, they had really good docs/guides on how to do all this with their roles and policies inherent in the GCE platform.
Thank you! 🙇♂️ |
Is there any documentation on what the https://github.com/aws/amazon-eks-pod-identity-webhook actually does? Is this just like kube2iam but for EKS clusters using the OICD provider? |
The gitrepo explains what the webhook does but not really why or how you would use it. The announcement blog post contains more details on the why and how. There's also the eksworkshop section about IAM roles but it's a little eksctl walk-through and less on why. I think we should create an example of how all this works in Terraform with this module. I'm on the fence over whether creating the IAM roles, profiles, namespaces and service accounts should be done in the module. That's massive feature creep. |
OK done: #710 Can some people have a look and maybe test the example?
I think I agree. Let's not add anything for this. |
cluster-autoscaler or IAM roles is not currently managed by EKS so no need to start doing so. Just an example to get started is fine. I suppose some pre-created IAM roles for cluster-autoscaler could be useful tho.. I am using this simple terraform module to create IAM roles with inline policies. See main.tf for usage - this suits my needs to easily create and manage IAM roles for kube2iam currently and should work similarly for IRSA. It doesn't support policy attachments but I've ended up not using them. Tho it's easy to create variations of the module or extend it.. https://gist.github.com/morganchristiansson/9220a94b4ba5af21107031c8cd783960 |
It just occured to me that there might be existing terraform module for iam roles.. and yes there is. Does what my module does and more. |
I think we should use a module from this repo: terraform-aws-modules/terraform-aws-iam#41 |
terraform-aws-iam module v2.5.0 has been just released with IAM assumable role with OIDC. Thanks @miguelaferreira , as usual ! |
OK I'm gonna close this now. An example has been added and also a module you can use. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I have issues
I'm submitting a...
What is the current behavior?
Since version 6.0.0 the module supports outputting the OIDC issuer URL. With this you can go through the steps documented here to create a service account with permissions for a policy.
What's the requested behavior?
It would be nice to have this automated. Allowing to do something like this:
where
iamserviceaccounts
would be a new map variable in the module with serviceaccounts as keys (qualified with name space before the slash) and policy ARNs as values.The text was updated successfully, but these errors were encountered: