Skip to content

Add AKS as a supported k8sMode - #333

Merged
movence merged 2 commits into
mainfrom
add-aks-k8smode
Jul 10, 2026
Merged

Add AKS as a supported k8sMode#333
movence merged 2 commits into
mainfrom
add-aks-k8smode

Conversation

@movence

@movence movence commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds AKS to k8sMode (EKS | ROSA | K8S | AKS). AKS has no EC2 instance role, so the agent and fluent-bit authenticate to AWS via workload-identity federation:

  • Project an SA token (aud sts.amazonaws.com) at /var/run/secrets/aws/token via the aws-iam-token volume
  • Set AWS_WEB_IDENTITY_TOKEN_FILE + AWS_ROLE_ARN for the SDK's AssumeRoleWithWebIdentity
  • Set RUN_IN_AKS=True for agent platform detection
  • New roleArn value, required when k8sMode: AKS
  • Wired into both the AmazonCloudWatchAgent CR and the fluent-bit DaemonSet, gated behind $isAKS (mirrors $isROSA).

Testing

  • helm lint clean; EKS/ROSA/K8S renders semantically identical to main
  • roleArn guard fails the render when AKS mode has no roleArn
  • AKS (live, k8s 1.35, OIDC + workload identity): agent + fluent-bit 1/1 Running, zero auth errors; CI metrics and container logs landing in CloudWatch
  • EKS (live, test-mc): upgraded with no regression — agent + fluent-bit unaffected (no AKS wiring), all signals (CI metrics, App Signals, X-Ray, logs) still flowing

Requires the paired agent change that skips the oidctoken path on AKS aws/amazon-cloudwatch-agent#2183. Operator prereq: IAM OIDC provider + role trust-scoped to system:serviceaccount::cloudwatch-agent / aud=sts.amazonaws.com, passed as roleArn.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Add "AKS" to k8sMode (alongside EKS | ROSA | K8S) so the chart can
target Azure Kubernetes Service. On AKS the agent and fluent-bit reach
AWS via workload-identity federation instead of a node instance role:

- Project a service account token (audience sts.amazonaws.com) at
  /var/run/secrets/aws/token via the aws-iam-token volume.
- Set AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ROLE_ARN so the AWS SDK
  default credential chain performs AssumeRoleWithWebIdentity.
- Set RUN_IN_AKS=True on the agent for platform detection.
- Expose a new top-level roleArn value, required when k8sMode is AKS.

Wiring is applied to both the CloudWatchAgent custom resource and the
fluent-bit DaemonSet (both use the cloudwatch-agent service account).
All AKS blocks are gated behind an $isAKS conditional mirroring the
existing $isROSA pattern; EKS, ROSA, and K8S render output is
unchanged.
{{- if .Values.containerLogs.enabled }}
{{- $clusterName := .Values.clusterName | required ".Values.clusterName is required." -}}
{{- $region := .Values.region | required ".Values.region is required." -}}
{{- $isAKS := eq .Values.k8sMode "AKS" -}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing validation for missing Role ARN similar to the CWA template

{{- $isAKS := eq $.Values.k8sMode "AKS" -}}
{{- if $isAKS }}{{- $_ := $.Values.roleArn | required ".Values.roleArn is required when k8sMode is AKS." -}}{{- end }}

Helm should render the CWA template before the fluent-bit one but helps to keep validations consistent across YAMLs

Mirror the roleArn required-guard from the CloudWatchAgent template into
the fluent-bit DaemonSet. The two templates are gated by independent
toggles (agent.enabled vs containerLogs.enabled), so with the agent
disabled and container logs enabled the CWA guard never renders and a
missing roleArn on AKS would silently emit an empty AWS_ROLE_ARN.
Addresses review feedback from @mitali-salvi.
@movence
movence merged commit 4102810 into main Jul 10, 2026
36 of 38 checks passed
@movence
movence deleted the add-aks-k8smode branch July 10, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants