IRSA credentials failing for AWS MSK IAM in Fluent Bit 4.1.0 — STS AssumeRoleWithWebIdentity returns broken connection (HTTP Status: 0) and fallback to IMDS occurs
- Dominant language
- C
- Stars
- 8.1k
- Forks
- 2k
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 71
Description
## Bug Report
When running Fluent Bit 4.1.0 on Amazon EKS using IRSA (IAM Roles for Service Accounts) to authenticate to MSK IAM, Fluent Bit consistently fails during the call to:
The internal AWS credential provider logs always show:
After the failure, Fluent Bit incorrectly falls back to IMDSv2, and retrieves credentials from the EC2 node role, not from the pod’s IRSA role.
This results in invalid MSK OAuthBearer tokens and ultimately:
Therefore, IRSA does not work with Fluent Bit for MSK IAM, even though the environment is correctly configured and STS is reachable externally.
🔄 Steps to Reproduce
1. Create Service Account with IRSA
2. Inject AWS environment variables into Fluent Bit pod
3. Configure MSK IAM authentication
4. Enable debug logs
❌ Actual Behavior
1. Fluent Bit fails during STS AssumeRoleWithWebIdentity
2. Fluent Bit incorrectly falls back to IMDSv2
This behavior is incorrect when IRSA is configured.
3. MSK authentication ultimately fails
The OAuth token is being signed with the wrong AWS principal (EC2 node instead of IRSA role).
✔ Expected Behavior
-
Fluent Bit should sucessfully perform AssumeRoleWithWebIdentity using the service account token.
-
There should be no fallback to IMDS when IRSA is active.
-
MSK IAM authentication should work using pod-level AWS IAM credentials.
🔍 Additional Diagnostics Performed
We performed multiple environment-level tests to rule out network, TLS, DNS and AWS STS connectivity issues.
1️⃣ Successful STS connectivity from test pod using curl
Running inside a pod using the same ServiceAccount:
The output shows:
-
TLS handshake works
-
STS responds with
HTTP/1.1 302 Found -
Certificate validation succeeds
This confirms the cluster CAN reach STS successfully.
2️⃣ Successful Fluent Bit HTTP output to STS
We configured Fluent Bit with a temporary HTTP output:
Result:
This demonstrates that:
✔ Fluent Bit’s HTTP client works
✔ TLS negotiation works
✔ External connectivity is fine
❗ Only the internal STS client inside:
flb_aws_credentials_sts.c
fails to connect.
This strongly points to:
-
internal TLS handling bug
-
keep-alive connection reuse issue
-
missing SNI or TLS config problem
-
incorrect interaction with AWS STS endpoints
📂 Environment Details
Component | Version
-- | --
Fluent Bit | 4.1.0
AWS EKS | 1.29
MSK | IAM authentication enabled
IRSA | correctly configured and verified
curl test to STS | success
Fluent Bit HTTP output to STS | success
Internal STS AssumeRoleWithWebIdentity | fails
📎 Recommended Evidence to Attach
We will attach:
-
Full Fluent Bit logs (with aws_credentials + http_client debug)
-
Curl output showing STS connectivity success
-
HTTP output plugin logs showing 302 from STS
-
IAM trust policy JSON
-
Kubernetes ServiceAccount manifest
-
Pod description showing injected AWS env vars
-
Screenshots of OIDC provider in AWS IAM console
🚀 Summary for Fluent Bit maintainers
The environment can reach STS with no issues (tested via curl and via Fluent Bit’s own HTTP output plugin).
Only the internal AWS credential provider inside Fluent Bit fails to connect to STS, returning
HTTP Status 0.This causes a fallback to IMDS, which breaks MSK IAM authentication.
As a result, IRSA cannot be used with MSK IAM in Fluent Bit 4.1.0.
[OUTPUT]
Name kafka
Match #{kafka-match}#
Brokers #{aws-msk-bootstrap-servers}#
Topics #{kafka-topic}#
Format json
aws_msk_iam true
aws_msk_iam_cluster_arn #{aws-msk-iam-cluster-arn}#
Contributor guide
Research direction
Start by tracing the internal AWS credential provider through STS AssumeRoleWithWebIdentity and the HTTP client, using the debug logs in the report. Check the IMDS fallback path and reproduce the EKS IRSA configuration; done means the pod role is used for MSK IAM authentication without an HTTP Status 0 failure or node-role fallback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, c, kubernetes
- Domain
- authentication, cloud, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100