Skip to content

Migrate aether mesh AWS credentials to IRSA web-identity (retire the static IAM key) #257

Closed

Description

@bpalermo

Context

Every other workload on the talos-main cluster has been migrated off static AWS access keys onto IRSA web-identity (self-hosted amazon-eks-pod-identity-webhook + the irsa.palermo.dev OIDC issuer). The aether mesh is the last workload still using a static IAM access key.

The cluster-side mechanism is already fully in place — no cluster changes are needed. The webhook injects AWS_ROLE_ARN + a projected SA token into any pod whose ServiceAccount carries an eks.amazonaws.com/role-arn annotation (including initContainers). AWS validates those tokens against irsa.palermo.dev (OIDC provider already published, served via Envoy directResponse). All that's left is on the app + AWS side, which is why this lives here.

Current state (static creds)

  • IAM user talos-main-aether-agent (1 access key, 1 inline policy) — credentials in AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY.
  • Consumers (both reference that user's key):
    • agent — DaemonSet, SA aether-agent (charts/aether/templates/agent-daemonset.yaml)
    • registrar — Deployment (charts/aether/templates/registrar-deployment.yaml)
  • Static creds Secret: charts/aether/templates/agent-secret.yaml.

Cutover plan

  1. Inventory the perms — read the talos-main-aether-agent IAM user's inline policy (the exact Action/Resource). Confirm the registrar's SA name and whether agent + registrar need the same perms.
  2. Create IRSA role(s) in account 988966554486 (e.g. talos-main-aether-agent-irsa, + a registrar role if its SA differs):
    • Trust: Federated = arn:aws:iam::988966554486:oidc-provider/irsa.palermo.dev, sts:AssumeRoleWithWebIdentity
    • Conditions: irsa.palermo.dev:aud = sts.amazonaws.com and irsa.palermo.dev:sub = system:serviceaccount:aether-system:<sa>
    • Inline policy = the perms from step 1.
    • (One role can serve both SAs via StringLike on :sub, or use two roles — preference.)
  3. Chart changes (charts/aether):
    • Annotate the agent + registrar ServiceAccounts: eks.amazonaws.com/role-arn: <role-arn>.
    • Remove the static AWS env (AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY / the agent-secret secretRef/envFrom) and drop agent-secret.yaml.
    • Keep AWS_REGION as a plain env (the webhook injects only AWS_ROLE_ARN + the token file; the webhook's defaultAwsRegion also injects a region).
  4. Deploy via the usual CI/OCI path.
  5. Validate each pod assumes its role before deleting the key — e.g. a throwaway pod using the SA running sts:get-caller-identity + the relevant AWS op.
  6. Delete the talos-main-aether-agent IAM user + its access key.

Gotchas (learned during the talos-main migration)

  • ARMv8.0 nodes: amazon/aws-cli (Amazon Linux base) crashes with a glibc … requires ARMv8.2-a fatal error on the Pi-class nodes. Use python:3.12-slim + boto3 for any validation pod. The real Go workloads are fine (Go binaries are ARMv8.0-safe).
  • The webhook does inject into initContainers (confirmed).
  • For a PSS-restricted namespace, a validation pod needs runAsNonRoot + runAsUser + dropped caps + seccompProfile: RuntimeDefault (and pip install --target since non-root).

References

  • Cluster IRSA setup + webhook + irsa.palermo.dev issuer live in bpalermo/k8s-talos-main (clusters/talos-main/{irsa-oidc,pod-identity-webhook}).
  • This is the same pattern already applied to kustomize-controller, spire-int-rotator, and spire-server.

🤖 Generated with Claude Code

Activity

  1. bpalermo commented on Jun 22, 2026

    @bpalermo
    OwnerAuthor

    Done — the static IAM key is fully retired.

    App/chart side (PR #258, deployed talos-main 0.17.0 rev 18)

    A code inventory corrected the issue's premise: the agent never calls AWS — it reaches the registry only via the registrar (NewRegistrarRegistry), and agent/internal/awsconfig was dead code imported by nothing. AWS is used only by the registrar's dynamodb backend. So:

    • Agent: removed the vestigial AWS_ACCESS_KEY_ID/SECRET env (mounted, never read), agent-secret.yaml, agent.awsCredentials, the awsSecretName helper, and the dead awsconfig package. No SA role.
    • Registrar: static envFrom replaced with IRSA — the registrar SA is annotated eks.amazonaws.com/role-arn when registrar.aws.roleArn is set (webhook injects AWS_ROLE_ARN + token). AWS_REGION kept as plain env.
    • No static keys remain in the chart.

    AWS side — already done

    Account 988966554486 has only the tf-cloud user; the live secret's access key had no owning IAM user (an access key can't exist without one). So talos-main-aether-agent and its key were already gone — nothing to delete on the IAM side.

    Cleanup

    • Deleted the stale/orphaned aether-agent-aws-credentials Secret (held an invalid key) after rolling the agent off it.
    • Removed the local gitignored agent/deploy/secrets.yaml.

    Deferred (not blocking)

    The registrar IRSA role isn't needed yet — talos is on the etcd backend, so the registrar makes zero AWS calls. Create talos-main-aether-registrar-irsa (trust irsa.palermo.dev, sub system:serviceaccount:aether-system:aether-registrar) from the ddb backend's perms and set registrar.aws.roleArn if/when DynamoDB is redeployed.

    Mesh healthy on 0.17.0: 13×1/1 + 2×2/2 (edge).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions