AWS EKS: Assign multiple Service Accounts to Deployment\Pod

10.4k views Asked by At

I'm using Kubeless on AWS EKS. While installing Kubeless, the installation has a manifest which has some CRDs and a deployment object. The deployment object has already a Service Account attached. I have created another Service Account in the kube-system namespace, which has some AWS IAM roles attached. I also want to attach this newly created Service Account used for IAM roles to the Kubeless deployment object by modifying the Kubeless manifest file.

I want to have 2 Service Accounts attached to the deployment object: One that comes with Kubeless and other for AWS IAM. Any help would appreciated. Thanks

1

There are 1 answers

2
TJ Zimmerman On

This is not possible. If you look at the API documentation for PodSpec v1 core you can see that serviceAccountName expects a string not an array or object. This is because using a ServiceAccount resource creates a 1:1 relationship between your pod and authentication against the API server.

You will either need to:

  1. Diversify your workload into multiple pods. Which with you can apply different service accounts.

  2. Combine your service account capabilities into a single account and apply it exclusively to this pod.

I recommend #2.