diff --git a/docs/codes/0008/junk/outputs/aws-iam-role-trust-relationship.json b/docs/codes/0008/junk/outputs/aws-iam-role-trust-relationship.json new file mode 100644 index 0000000..542f717 --- /dev/null +++ b/docs/codes/0008/junk/outputs/aws-iam-role-trust-relationship.json @@ -0,0 +1,18 @@ +{ + "Statement": [ + { + "Action": "sts:AssumeRoleWithWebIdentity", + "Condition": { + "StringEquals": { + "4f0fce7c-9efa-9ee3-5fe0-467d95d2584c.developer-friendly.blog:aud": "sts.amazonaws.com", + "4f0fce7c-9efa-9ee3-5fe0-467d95d2584c.developer-friendly.blog:sub": "system:serviceaccount:default:demo-service-account" + } + }, + "Effect": "Allow", + "Principal": { + "Federated": "arn:aws:iam::XXXXXXXXXXXX:oidc-provider/4f0fce7c-9efa-9ee3-5fe0-467d95d2584c.developer-friendly.blog" + } + } + ], + "Version": "2012-10-17" +} diff --git a/docs/posts/0008-k8s-federated-oidc.md b/docs/posts/0008-k8s-federated-oidc.md index 12393d4..bb00275 100644 --- a/docs/posts/0008-k8s-federated-oidc.md +++ b/docs/posts/0008-k8s-federated-oidc.md @@ -2,8 +2,8 @@ date: 2024-04-22 draft: true description: >- - How to access AWS from bear-metal Kubernetes (K3s) Service Accounts using - OIDC by establishing a trust relationship between the Kubernetes and AWS IAM. + How to access AWS with bear-metal Kubernetes (K3s) Service Accounts tokens + by establishing an OIDC trust relationship between the Kubernetes and AWS IAM. categories: - Kubernetes - AWS @@ -26,24 +26,6 @@ links: # Grant Kubernetes Pods Access to AWS Services Using OpenID Connect - - Learn how to establish a trust relationship between a Kubernetes cluster and AWS IAM to grant cluster generated Service Account tokens access to AWS services using OIDC & without storing long-lived credentials. @@ -577,6 +559,15 @@ created. -8<- "docs/codes/0008/configure-oidc/outputs.tf" ``` +The AWS IAM Role trust relationship will look something like this: + +```json title="AWS IAM Role Trust Relationship" +-8<- "docs/codes/0008/junk/outputs/aws-iam-role-trust-relationship.json" +``` + +This, of course, shouldn't come as a surprise. We have already seen this in the +TF definition above. + ## Step 7: Test the Setup We have created the IAM Role with the trust relationship to the OIDC provider @@ -729,166 +720,6 @@ you have learned something new and useful from it. Until next time, *ciao* :cowboy: & happy coding! :penguin: :crab: - - - - - - - - [k3s]: https://docs.k3s.io/ [aks]: https://learn.microsoft.com/en-us/azure/aks/