You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/management-bundles.md
+93Lines changed: 93 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -680,6 +680,79 @@ Both methods are going to need a policy for either the service account or the IA
680
680
3. Once the policy has been created, it can be assigned to the role.
681
681
4. With the role created, go to the EC2 instance view. Select an instance where OPA will run and select "Actions" -> "Security" -> "Modify IAM role". Select the role created in previous steps.
682
682
683
+
##### Web Identity Credentials
684
+
685
+
Using EKS IAM Roles for Service Account (Web Identity) Credential.
686
+
687
+
Below are steps to use OpenID connect provider and kubernetes.
688
+
689
+
1. Go to the "IAM" section of the AWS console.
690
+
2. Click Add provider and select OpenID connect.
691
+
3. For Provider URL enter the one belonging to your chosen kubernetes cluster.
692
+
4. Click on Get thumbprint
693
+
5. For the audience enter: sts.amazonaws.com
694
+
6. Add the provider.
695
+
7. Once the provider is added, copy the ARN for the identity provider. Here's an example ARN: arn:aws:iam::<your AWS account ID>:oidc-provider/oidc.eks.ap-northeast-1.amazonaws.com/id/DFGHJKKJHGF34HFDFGHY44TRFDE4RGDF
696
+
8. Create an IAM role (eg: app_dev_role) with the policy created above and assign it to the kubernetes service account.
697
+
9. Go to Trust relationships inside the created role and click Edit trust relationship and enter the following policy document.
698
+
```json
699
+
{
700
+
"Version": "2012-10-17",
701
+
"Statement": [
702
+
{
703
+
"Effect": "Allow",
704
+
"Principal": {
705
+
"Federated": "<the ARN of the Identity provider from step 7, e.g. arn:aws:iam::123456789012:oidc-provider/oidc.eks.ap-northeast-1.amazonaws.com/id/DFGHJKKJHGF34HFDFGHY44TRFDE4RGDF where 123456789012 is the account ID of your AWS account, and DFGHJK...4RGDF is the OpenID Connect URL's end>"
706
+
},
707
+
"Action": "sts:AssumeRoleWithWebIdentity",
708
+
"Condition": {
709
+
"StringEquals": {
710
+
"<the OpenID connect URL, e.g. oidc.eks.ap-northeast-1.amazonaws.com/id/B7060B6E991747ADDDC61ADD4B7875CF>:sub": "system:serviceaccount:<kubernetes namespace, e.g. app-dev>:<the kubernetes serviceaccount name, eg: app-dev-service-account>"
711
+
}
712
+
}
713
+
}
714
+
]
715
+
}
716
+
```
717
+
10. Create the kubernetes service account.
718
+
```yaml
719
+
apiVersion: v1
720
+
kind: ServiceAccount
721
+
metadata:
722
+
annotations:
723
+
eks.amazonaws.com/role-arn: <the ARN of the IAM role from your account, e.g. arn:aws:iam::<aws_account eg, 123456789012>:role/app_dev_role>
724
+
name: <service account name, e.g. app-dev-service-account>
725
+
namespace: <k8 namespace, e.g. app-dev>
726
+
automountServiceAccountToken: false
727
+
```
728
+
11. Configure your kubernetes resources to use this service account.
729
+
```yaml
730
+
apiVersion: apps/v1
731
+
kind: Deployment
732
+
metadata:
733
+
******
734
+
spec:
735
+
******
736
+
template:
737
+
*******
738
+
spec:
739
+
serviceAccountName: app-dev-service-account # <--- like this
740
+
automountServiceAccountToken: true
741
+
containers:
742
+
******
743
+
```
744
+
745
+
You should now be able to access AWS services from your kubernetes cluster.
746
+
747
+
The above steps should add the following variable to the pod.
748
+
749
+
```bash
750
+
AWS_ROLE_ARN=<the ARN of the IAM role from your account, e.g. arn:aws:iam::123456789012:role/app_dev_role>
**NOTE:** the S3 `url` is the bucket's regional endpoint.
831
+
739
832
##### Credential Provider Chaining
740
833
741
834
Multiple AWS credential providers can be configured. OPA will follow an *internally defined* order to try each of the credential provider given in the configuration till success. Following order of precedence is followed when multiple credential provider is given in the configuration
0 commit comments