<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>ROSA | Tech Learning Hub</title><link>https://www.tech-learning-hub.com/tag/rosa/</link><atom:link href="https://www.tech-learning-hub.com/tag/rosa/index.xml" rel="self" type="application/rss+xml"/><description>ROSA</description><generator>Hugo Blox Builder (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Tue, 11 Aug 2026 00:00:00 +0000</lastBuildDate><image><url>https://www.tech-learning-hub.com/media/logo_hu17383905045384214746.png</url><title>ROSA</title><link>https://www.tech-learning-hub.com/tag/rosa/</link></image><item><title>Using IAM roles with ROSA</title><link>https://www.tech-learning-hub.com/post/iam/rosa-assumerole/</link><pubDate>Tue, 11 Aug 2026 00:00:00 +0000</pubDate><guid>https://www.tech-learning-hub.com/post/iam/rosa-assumerole/</guid><description>&lt;h3 id="overview">Overview&lt;/h3>
&lt;p>Here is the architecture and call flow illustrating how your ROSA Spring Boot application uses its ServiceAccount to authenticate with AWS MSK via AWS STS and IAM.&lt;/p>
&lt;h3 id="iam-roles-for-service-accounts-irsa-call-flow">IAM Roles for Service Accounts (IRSA) Call Flow&lt;/h3>
&lt;div class="mermaid">sequenceDiagram
autonumber
actor Pod as ROSA Pod (Spring Boot / AWS SDK)
participant Kubelet as ROSA Kubelet
participant STS as AWS STS (AssumeRoleWithWebIdentity)
participant IAM as AWS IAM (OIDC Trust Provider)
participant MSK as Amazon MSK
Note over Pod, Kubelet: 1. Pod Initialization
Kubelet->>Pod: Mounts OIDC JWT Token to /var/run/secrets/...
Kubelet->>Pod: Injects AWS_ROLE_ARN &amp; AWS_WEB_IDENTITY_TOKEN_FILE
Note over Pod, IAM: 2. Authentication Flow
Pod->>Pod: Kafka Client triggers aws-msk-iam-auth library
Pod->>STS: POST AssumeRoleWithWebIdentity
(Includes JWT Token &amp; Role ARN)
STS->>IAM: Validate JWT Signature &amp; Trust Policy
IAM-->>STS: Validation Successful (OIDC Match, sub/aud match)
STS-->>Pod: Returns Temporary AWS Credentials
(AccessKeyId, SecretAccessKey, SessionToken)
Note over Pod, MSK: 3. Resource Access
Pod->>Pod: SDK generates SigV4 Signature using temporary credentials
Pod->>MSK: Connect (SASL/AWS_MSK_IAM) + SigV4 Payload
MSK-->>Pod: Connection Established (Topic access granted)
&lt;/div>
&lt;hr>
&lt;h3 id="step-by-step-breakdown">Step-by-Step Breakdown&lt;/h3>
&lt;ol>
&lt;li>&lt;strong>Token Injection (Cluster Side):&lt;/strong> When your pod spins up, the OpenShift mutating webhook (or EKS Pod Identity Webhook) intercepts the scheduling request. Seeing the &lt;code>[eks.amazonaws.com/role-arn](https://eks.amazonaws.com/role-arn)&lt;/code> annotation on your ServiceAccount, it injects environment variables and mounts a projected volume containing a short-lived OpenID Connect (OIDC) JWT token into the pod.&lt;/li>
&lt;li>&lt;strong>SDK Initiation:&lt;/strong> When the Spring Boot application starts and attempts to connect to Kafka, the &lt;code>aws-msk-iam-auth&lt;/code> library kicks in. It reads the &lt;code>AWS_WEB_IDENTITY_TOKEN_FILE&lt;/code> and &lt;code>AWS_ROLE_ARN&lt;/code> environment variables injected in step 1.&lt;/li>
&lt;li>&lt;strong>The STS Call:&lt;/strong> The AWS SDK makes an HTTPS &lt;code>POST&lt;/code> request to the AWS Security Token Service (STS) endpoint, specifically calling the &lt;code>AssumeRoleWithWebIdentity&lt;/code> API. It passes the contents of the JWT token and the ARN of the IAM Role it wants to assume.&lt;/li>
&lt;li>&lt;strong>IAM Trust Evaluation:&lt;/strong> AWS STS does not blindly trust the token. It reaches out to AWS IAM to:&lt;/li>
&lt;/ol>
&lt;ul>
&lt;li>Fetch the public keys from the OIDC Provider URL (registered in AWS IAM) to verify the token&amp;rsquo;s cryptographic signature.&lt;/li>
&lt;li>Verify the IAM Role&amp;rsquo;s &lt;strong>Trust Policy&lt;/strong> (specifically checking that the &lt;code>sub&lt;/code> claim matches the ROSA namespace/service account and the &lt;code>aud&lt;/code> claim matches &lt;code>sts.amazonaws.com&lt;/code>).&lt;/li>
&lt;/ul>
&lt;ol start="5">
&lt;li>&lt;strong>Credential Delivery:&lt;/strong> Once validated, AWS STS generates short-lived, temporary AWS credentials (an Access Key, Secret Key, and Session Token) and returns them to the pod.&lt;/li>
&lt;li>&lt;strong>MSK Authentication:&lt;/strong> The &lt;code>aws-msk-iam-auth&lt;/code> library uses these temporary credentials to sign the SASL authentication payload using AWS Signature Version 4 (SigV4). It sends this signed request to the MSK Broker.&lt;/li>
&lt;li>&lt;strong>Access Granted:&lt;/strong> MSK verifies the SigV4 signature and checks the associated IAM Role&amp;rsquo;s permissions policy (e.g., &lt;code>kafka-cluster:WriteData&lt;/code>). If permitted, the TCP connection is successfully established.&lt;/li>
&lt;/ol>
&lt;hr>
&lt;h3 id="official-documentation-references">Official Documentation References&lt;/h3>
&lt;p>To dive deeper into the specific API calls and mechanisms shown in this flow, you can reference the following official documentation:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>AWS STS API Reference:&lt;/strong> &lt;a href="https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html" target="_blank" rel="noopener">AssumeRoleWithWebIdentity&lt;/a> - Details the exact parameters and expected responses during the STS exchange.&lt;/li>
&lt;li>&lt;strong>AWS IAM Documentation:&lt;/strong> &lt;a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc.html" target="_blank" rel="noopener">OIDC Federation and Web Identity&lt;/a> - Explains how AWS IAM trusts external OIDC identity providers like ROSA.&lt;/li>
&lt;li>&lt;strong>Red Hat OpenShift (ROSA):&lt;/strong> &lt;a href="https://www.google.com/search?q=https://docs.openshift.com/rosa/aws_integration/understanding-iam-roles-for-service-accounts.html" target="_blank" rel="noopener">Using IAM roles for service accounts (IRSA) with ROSA&lt;/a> - Explains the cluster-side token projection and webhook injection mechanics.&lt;/li>
&lt;li>&lt;strong>Amazon MSK:&lt;/strong> &lt;a href="https://docs.aws.amazon.com/msk/latest/developerguide/iam-access-control.html" target="_blank" rel="noopener">IAM Access Control&lt;/a> - Details how MSK natively evaluates IAM policies attached to the roles assumed by your clients.&lt;/li>
&lt;/ul></description></item></channel></rss>