by bearforcenine · 8y ago · 0 comments
I am curious if AWS has any plans to build an IAM integration for K8s that provides IAM credentials/roles directly to pods. An integration through EKS or K8s directly would make interacting with AWS resources very easy.
Being able to authenticate to the K8s cluster using https://github.com/kubernetes-sigs/aws-iam-authenticator is nice, but it doesn't help give pods IAM roles.
in fact, if you check out the source (located here: https://github.com/awslabs/aws-service-operator) it's recommended to use kube2iam
edit: haven't fully read the article yet but if the operator supports managing IAM roles thru a CRD you could potentially create the role and attach it via annotation in one go.
double edit: looks like IAM roles aren't directly supported yet, the following is what appears to be supported:
- cloudformation templates
- dynamodb
- s3
- sns subscriptions and topics
- sqs queues
- ecr repos
You just create a role give it an assume role policy that allows the node to assume it. Then annotate your pod w/ the role arn. When they make a call to get their instance profile you get the role instead.
It's a little annoying in that your pod code thinks its making a metadata call (which is super super fast), but what is actually happening is kube2iam intercepted that and will make a sts:assumerole call... which takes forever. So people just need to set their timeout a little higher than normal.
Full disclosure: I work on EKS at AWS
I'm sure we'll see much tighter integration over time.
(I work at AWS SSM, but not directly on the on-prem featureset.)