Using AWS SecretManager with Fargate: Unable to locate credentials

Viewed 416

The scenario:

We have a K8s cluster on EKS using Fargate nodes. I am storing our credentials/secrets in AWS SecretManager and want our workers deployed on AWS Fargate to access these secrets directly.

The issue:

The python code inside the containers throw the following error, as it cannot find any aws credentials):
botocore.exceptions.NoCredentialsError: Unable to locate credentials

It is quite similar to the issue raised here and I already went ahead to add a service account as proposed in the answer to that question.

Specifically, I followed the guide here.

However, the last step does not return the expected output for me. There is no AWS environment variable being injected into any of the pods.

I also tried following the workshop here:https://www.eksworkshop.com/beginner/110_irsa/deploy/ but still not getting the expected output.

I will appreciate if anyone can point me in the right direction here. Thanks in advance!

1 Answers

I believe you are missing the cluster create steps as described here. Specifically:

  • Set up the OIDC ID provider (IdP) in AWS.

If you like to inject things into your Pods automatically consider creating a MutatingAdmissionWebhook which basically responds to with JSONPatch that K8s applies to whatever object you specify.

This is a detailed walkthrough on how to create one.

Related