KatInterview

Authenticating Kubernetes Workloads to External APIs Securely

System DesignModel answer
MediumModel answerSystem Designkubernetessecuritycloud-native

Last updated

Evaluate methods for providing third-party API tokens to Kubernetes workloads, focusing on credential lifecycle, secret rotation, and workload identity.

You are designing the architecture for a microservice deployed inside a Kubernetes cluster. This microservice needs to interact with an external third-party service hosted outside the cluster boundaries. Requests to this external API must include an authentication token.

Outline the primary strategies for delivering this token to your Kubernetes workloads. Compare each strategy across key dimensions:

  • Security posture (blast radius, exposure risks, RBAC, and encryption at rest)
  • Token lifecycle and rotation (zero-downtime updates, automation capability)
  • Operational overhead (complexity of management and deployment)

Finally, provide a clear recommendation for modern cloud-native environments, and explain under what circumstances alternative strategies should be chosen.

Clarifying Questions to Consider

  • Is the external token static and long-lived, or can it be dynamically requested/federated (e.g., via OpenID Connect or Cloud IAM Workload Identity)?
  • Can the application hot-reload secret changes from disk, or does it require a process restart?
  • Is the cluster managed on a public cloud platform (AWS, GCP, Azure), or is it running on-premises?

Hints

Hint 1

Consider the difference in process visibility and filesystem behavior between environment variables and mounted volume secrets.

Hint 2

Think about how modern cloud providers eliminate static keys entirely using OIDC federation and service account token projection.

Hint 3

Evaluate how external secret sync tools (like External Secrets Operator or HashiCorp Vault CSID) bridge external secret stores to native K8s resources.