Engineering Journal

Article 6 of 8

RBAC, Workload Identity and NetworkPolicy: Three Different Security Boundaries

Three controls, three threat models, and three very different questions.

2026-11-15•9 min read

Interactive field lab · hypothetical scenarios

Find the permission boundary

Blocked: Federation trust accepts identity.

Evaluated gates: Network path allows connection → Federation trust accepts identity → Cloud policy permits object read. Other toggles do not authorize this destination.

Conceptual gates. Network failure masks later authorization checks. Provider federation details vary; this does not evaluate real policies.

A worker can list Pods, cannot read an object from cloud storage, and cannot connect to its database. Giving it a broader Kubernetes Role would address only one of those boundaries, and might unnecessarily increase access.

Before changing a policy, identify the destination, the identity presented, and the system making the decision.

Ask who decides

RequestDecision makerRelevant control
List Pods through the Kubernetes APIAPI authentication and authorizationServiceAccount identity and RBAC
Read an object from a cloud APICloud identity and authorization systemsFederated workload identity, trust, and cloud permissions
Open a TCP connection to a database PodNetwork policy enforcement and network pathNetworkPolicy and the supporting network implementation

These controls compose. Network reachability does not grant application authorization. Correct credentials cannot repair a blocked route. A successful cloud request says nothing about whether the workload can delete Kubernetes Secrets.

RBAC: verbs on API resources

A ServiceAccount supplies a Kubernetes identity. A Role grants permissions within a namespace; a RoleBinding connects a role to subjects. ClusterRoles can describe cluster-scoped or reusable permissions. Binding a ClusterRole with a RoleBinding limits its namespaced permissions to the binding namespace; a ClusterRoleBinding has cluster-wide scope.

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: pod-reader
  namespace: shop
rules:
  - apiGroups: [""]
    resources: ["pods"]
    verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: worker-pod-reader
  namespace: shop
subjects:
  - kind: ServiceAccount
    name: worker
    namespace: shop
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: pod-reader

This does not grant Secret access or cloud storage access. RBAC permissions are additive: there is no RBAC deny rule that cancels a grant from another binding. Review effective permissions across all bindings. Avoid wildcards, and treat privilege-escalation paths such as role binding, impersonation, and workload creation as part of the threat model.

Workload identity: a trust exchange

In a typical federated setup, a workload obtains a short-lived, audience-bound ServiceAccount token. An external identity system validates its issuer, audience, subject, and trust conditions before issuing credentials or accepting the token. The cloud service then evaluates permissions for the resulting identity.

The integration is provider-specific. Creating a ServiceAccount or RoleBinding alone does not configure cloud federation. Check the exact namespace and ServiceAccount subject, intended audience, configured issuer, token projection, SDK credential selection, and external role policy. Avoid printing tokens during diagnosis.

Disable automatic ServiceAccount token mounting for workloads that do not need it, while accounting for provider integrations that use projected tokens. Prefer short-lived tokens over manually maintained long-lived credential Secrets.

NetworkPolicy: traffic permission

NetworkPolicy selects Pods and specifies allowed ingress or egress. It requires a network implementation that actually enforces the API. Creating a policy object in an unsupported cluster does not establish isolation.

Pods are initially non-isolated for a direction until selected by a policy applying to that direction. Applicable allow rules combine additively. When both ends are isolated, source egress and destination ingress must allow a connection. Policies are primarily network-layer controls; they do not provide general HTTP method authorization, encryption, or cloud IAM permissions.

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: database-from-api
  namespace: shop
spec:
  podSelector:
    matchLabels:
      app: database
  policyTypes: [Ingress]
  ingress:
    - from:
        - podSelector:
            matchLabels:
              app: checkout
      ports:
        - protocol: TCP
          port: 5432

Here the peer Pod selector selects checkout Pods in the same namespace. This policy restricts selected database Pods' ingress, but does not configure source egress, database credentials, or TLS. A complete default-deny rollout needs explicit allowances for actual dependencies, including DNS where egress isolation applies.

Experiment: fix one boundary at a time

In the boundary lab, choose a Kubernetes API, cloud API, or database request. Toggle API authorization, federation trust, cloud permission, network allowance, and database credentials independently. Notice how an early failure can hide a later one. All-green results represent only the modeled checks, not proof of a secure system.

Debug without escalating blindly

Start with the failing operation and sanitized error. For Kubernetes API authorization, inspect the workload's ServiceAccount and effective permission:

kubectl auth can-i list pods -n shop --as=system:serviceaccount:shop:worker
kubectl -n shop get rolebindings
kubectl -n shop get networkpolicies

The impersonated check requires the operator to have impersonation permission. A forbidden result from running the check itself is not evidence about the workload. For cloud errors, inspect trust and permission separately. For network timeouts, confirm enforcement, DNS, source egress, destination ingress, routing, and the listener. Finally verify application authentication.

The practical lesson

Write a permission request as a sentence: this identity needs this operation on this resource through this path. That sentence exposes whether the fix belongs in RBAC, federation, cloud authorization, networking, or the application.

Sources and scope

Examples are minimal teaching examples, not a complete security baseline. The simulator models independent gates and does not contact cloud services.