A Kubernetes-Native Approach to Non-Human Identity

S

Shankar Palakodeti

Guest
CNAPPs and non-human identity platforms have become good at telling us what exists: which ServiceAccounts, roles and clients live in our environments, and what they can reach. They still work out how those pieces relate by inference, from tags, naming conventions and activity logs. That is where context gets lost: a role with no clear owner, a federated trust nobody remembers creating, a client left behind after its workload was deleted.

This article argues for a Kubernetes-native design in which namespaces and ServiceAccounts declare identity intent (source of truth). The kubernetes operator reconciles it into corresponding IdP resources and federates the Kubernetes identities to relevant cloud provider. Every resource it creates carries provenance a CNAPP can read without a custom integration. We compare the approach with SPIFFE/SPIRE and infrastructure-as-code, walk through its threat model, including what we haven’t solved yet, and demonstrate it with Myceliam, an open-source kubernetes operator.

The gap: discovery reconstructs, provisioning declares​


Discovery tells us what exists. Provisioning defines what should exist and how the pieces connect. Today, security tooling only gets the first.

Take one workload: a ServiceAccount payments/payment-api, a client in the enterprise IdP, and an AWS role it assumes through OIDC federation. A CNAPP can find all three. To link them, it has to infer from naming, tags or CloudTrail activity that they belong together. When that inference fails, the role shows up as an orphan, or as an over-privileged identity with no owner.

Yet the relationship was known exactly at one moment: when someone created it. In most organizations that knowledge is scattered across Terraform modules, cloud-specific annotations, CI pipelines and tickets, and it isn't kept current as the workload changes or disappears.

Our claim is narrow. The provisioning layer should record identity intent explicitly, keep it reconciled and expose it. The CNAPP stays the place where risk is evaluated.

Where today's building blocks stop​


FiYVfdjR0eWNik1mhM1FDxme2mn1-p893b1d.png


SPIFFE/SPIRE standardizes how a workload proves who it is. Each workload gets a SPIFFE ID, such as spiffe://prod.example.com/ns/payments/sa/payment-api, and short-lived SVIDs (X.509 or JWT). To reach cloud APIs, the trust domain is published through SPIRE's OIDC Discovery Provider, and each cloud is configured to trust it: an IAM OIDC identity provider in every AWS account, a workload identity pool provider in every GCP project, a federated credential in Azure. Roles then match the SPIFFE ID in the JWT's sub claim.

That federation is configuration SPIFFE leaves to us. Every trust domain has to be registered in every account and project that needs it, and every role's trust policy has to list the right SPIFFE IDs. With several trust domains and many accounts, that becomes a matrix maintained outside the platform. SPIFFE gives us a strong identity. It doesn't provision or reconcile the trust relationships around it. This is true for Kubernetes cluster’s OIDC server and IdPs too.

Infrastructure-as-code and cloud operators (Terraform, Crossplane, AWS Controllers for Kubernetes, GCP Config Connector, Azure Service Operator) can create those providers and roles. But they manage resources one cloud at a time. They don't model a ServiceAccount, its IdP client and its cloud roles as one identity, and they don't record that link on what they create.

The missing piece is a layer that treats workload identity as one object spanning the cluster, the IdP and the clouds.

Kubernetes as the source of intent​


We treat objects platform teams already manage as the declaration of identity intent, and an operator reconciles them outward.


Kubernetes object

What the operator maintains

Namespace

A realm (identity boundary) in the enterprise IdP

ServiceAccount

An OIDC client in that realm

Cloud account or project association

Federated roles and bindings that trust the IdP

The key design choice is where the clouds anchor their trust (any OIDC IdP). Although Myceliam can establish trust between individual Kubernetes cluster’s OIDC server and cloud providers, wiring Kubernetes clusters through an enterprise IdP offers several benefits including but not limited to consistent enterprise policy management, RBAC and central auditing.

In Myceliam, cloud accounts and projects trust the enterprise IdP (Keycloak today, any OIDC IdP in principle), not each cluster. Each account or project registers one OIDC provider. Clusters can be added or retired without touching cloud trust configuration, which removes the cluster-by-account matrix described above.

Trust still has to be precise at the cloud boundary. The convention we're adopting names token audiences <cloud>-<cluster-id>-<namespace> and scopes each role's trust condition to the specific ServiceAccount client. No token is shared across clouds.

When a namespace or ServiceAccount is deleted, the operator removes the realm, client and bindings it created. Cleanup follows the workload's lifecycle instead of a ticket.

Three deployment modes​


The same intent model runs in three modes. They differ in what the workload uses to prove its identity and in which credentials the operator holds.



A: Cluster OIDC

B: Direct IdP

C: SPIFFE

Workload proves identity with

Projected ServiceAccount token, exchanged for an IdP JWT

Client credentials grant against the IdP

SVID issued by SPIRE

Token the clouds trust

Cluster OIDC or Enterprise IdP

Enterprise IdP

SPIRE trust domain

Operator authenticates with

Its own projected ServiceAccount token

IdP admin credentials stored in the cluster

Nothing: it doesn't talk to the IdP or the SPIRE server

Operator configures

IdP realms and clients, cloud federation

IdP realms and clients, cloud federation

Cloud federation only

Long-lived secrets

None

Client secrets and operator admin credentials

None

Admin is responsible for

IdP trusting the cluster's OIDC issuer

Namespace-level RBAC on those Secrets, and rotating them

Running SPIRE and its registration entries

Mode A: cluster OIDC. The workload reads its kubelet-projected ServiceAccount token and exchanges it at the IdP for an IdP-issued JWT. The operator uses the same mechanism to configure the IdP, so nothing in the cluster holds a static secret. Per-cluster trust still exists, but it lives in one place, the IdP, rather than in every cloud account. This mode suits teams that want to keep the cluster's OIDC issuer as the root of workload identity.

Mode B: direct IdP. There's no cluster OIDC issuer in the path and no projected token. The application fetches its JWT from the IdP with client credentials, and the operator keeps its IdP admin credentials in the cluster. This works anywhere, including clusters whose issuer the IdP can't reach, but the admin has to lock down access to those Secrets with namespace-level RBAC and rotate them.

Mode C: SPIFFE. SPIRE issues the workload's identity and the operator stays out of that path entirely: it talks to neither the IdP nor the SPIRE server. Its job is the cloud side, maintaining federation and role trust for SPIFFE IDs that follow the namespace and ServiceAccount, so the trust-domain-by-account matrix is reconciled rather than hand-built.

Provenance: connecting who a workload is to what it does​


A CNAPP sees what an identity does: the API calls it makes, the data it reaches, the attack paths that run through it. It rarely knows who that identity is in platform terms: which cluster, namespace, ServiceAccount and team. Myceliam closes that gap by design, stamping provenance on everything it creates.

Myceliam is named after mycelium, the hidden underground fungal network that connects separate organisms and lets them trade nutrients. In the same way, Myceliam is a Kubernetes operator that weaves identity threads between clusters, identity providers and clouds. It watches namespace and ServiceAccount events and creates the matching resources in IdPs and cloud IAM on demand, so workloads can exchange short-lived credentials to access cloud resources.

The core idea of Myceliam is a fixed mapping from Kubernetes constructs to identity-provider and cloud constructs. Everything is derived from names, so the operator never needs a database. Examples:


Kubernetes

Keycloak

Auth0

AWS

GCP

Namespace

Realm <cluster-id>-<namespace>

No per-namespace container; one shared Resource Server per cloud, <cloud>-<cluster-id>-<namespace>

IAM OIDC provider per account, keyed by issuer URL

WLI provider <cluster>-<namespace>-<idp> in a shared pool

ServiceAccount

Client whose client_id is the SA name

Application + Client Grant

ClientIDList entry + one tagged trust-policy statement per role

workloadIdentityUser binding on each target SA

Every IdP client, IAM role and federated binding carries the same attributes (cluster, namespace and ServiceAccount) as cloud tags, labels or client attributes. This needs no vendor integration. CNAPPs already ingest cloud tags, so a finding on an AWS role traces straight back to the workload that owns it. An identity with provenance but no live workload becomes a reliable orphan signal rather than a guess.


Question

Answered by

Which workload uses this role?

Provenance attributes (provisioning layer)

What can the role reach, and is that too much?

CNAPP / CIEM analysis

Is the workload vulnerable or exposed?

CNAPP

Should this identity still exist?

Operator reconciliation, verified by the CNAPP

Threat model and trade-offs​

  • In mode B, the operator holds long-lived credentials. It needs admin rights in the IdP and IAM-write rights in each cloud, and stores static credentials for both in the cluster. Whoever compromises the operator can mint identities and trust.
  • In mode B, workloads receive client secrets. A ServiceAccount's IdP client secret is delivered as a Kubernetes Secret, and the application fetches its JWT directly from the IdP, bypassing kubelet-projected tokens. That's a static credential with the usual exposure risks. The operator can be configured to renew them periodically.
  • Kubernetes RBAC becomes identity policy. Whoever can create a namespace or ServiceAccount can cause a realm or client to be created. Those rights have to be treated as identity-provisioning rights.
  • The IdP is the single trust anchor. Anchoring every cloud on one IdP removes per-cluster sprawl, but a compromised IdP signing key reaches every federated account. Key protection, rotation and narrowly scoped role conditions matter more, not less.

Where this is headed for the Myceliam operator​

  1. Projected-token exchange for workloads. The app presents its kubelet-projected ServiceAccount token to the IdP and exchanges it for an IdP-issued JWT. No client secret is stored, tokens are short-lived and audience-bound, and the cluster's own OIDC issuer stays the root of the workload's proof, for teams that want to keep it.
  2. No static credentials in the operator. The operator authenticates to the IdP and the clouds with its own projected token, through the same federation it manages.
  3. A feedback loop from findings to intent. When a CNAPP flags an overly broad trust relationship, the fix lands in the desired configuration and the operator reconciles it. The operator enforces only what it owns, such as federation trust conditions. IAM permission policies stay with a separate remediation workflow.

Takeaways​

  • Inferencing and provisioning answer different questions. Security tooling needs both.
  • Identity relationships are known exactly once, at creation. Record them there and keep them reconciled.
  • Anchoring cloud trust on the enterprise IdP removes the cluster-by-account federation matrix, at the cost of one well-protected trust anchor.
  • Provenance on provisioned identities lets any CNAPP connect what an identity does to the workload it belongs to, with no custom integration.

Myceliam is open source: More on Myceliam · GitHub.
 

Thread statistics

Created
Shankar Palakodeti,
Replies
0
Views
6
Back
Top