The shutdown of Rackspace Spot following a credential breach that exposed Kubernetes Secrets is a sobering reminder for every platform team: perimeter security alone will not save your cluster.
When attackers obtain valid cloud or cluster credentials, they don't need to break down the front door—they walk right through it with legitimate permissions. If your internal cluster posture relies on implicit trust, a single leaked token or over-privileged service account is enough to compromise every workload and database connected to your environment.
Here is how to close those internal gaps and enforce Zero Trust inside your Kubernetes boundary.
1. Stop Storing Raw Secrets in Plain Manifests or Env Vars
Native Kubernetes Secret objects are base64-encoded, not encrypted at rest by default, and mounting them as environment variables exposes sensitive values to crash dumps, debug endpoints, and child processes.
Instead of committing or injecting static secrets:
-
Enable Encryption at Rest for
etcdusing a cloud KMS provider (EncryptionConfiguration). -
Use Dynamic Secret Engines like HashiCorp Vault or AWS Secrets Manager paired with the External Secrets Operator (ESO) or Secrets Store CSI Driver. Secrets are fetched at runtime directly into memory (
tmpfs) and rotated automatically without touching Git or environment variables.
2. Enforce Least-Privilege RBAC & Disable Auto-Mounted Tokens
By default, Kubernetes mounts a service account token into every pod—even when the application never talks to the Kubernetes API. Furthermore, broad get or list permissions on secrets across namespaces turn a single compromised pod into a cluster-wide credential harvester.
Lock down your Pod specs and Role definitions:
apiVersion: v1
kind: ServiceAccount
metadata:
name: payment-worker-sa
namespace: production
automountServiceAccountToken: false
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: payment-secret-reader
namespace: production
rules:
- apiGroups: [""]
resources: ["secrets"]
# Restrict access to named secrets only—never allow wildcard list/watch
resourceNames: ["payment-db-creds"]
verbs: ["get"]
3. Replace Long-Lived Static Keys with Short-Lived OIDC Tokens
Static cloud access keys (AWS_ACCESS_KEY_ID, GCP JSON keys) stored inside clusters are prime targets during breaches because they remain valid until someone manually revokes them.
Migrate workload identity to OIDC federation:
- AWS: IAM Roles for Service Accounts (IRSA) or EKS Pod Identity
- GCP: Workload Identity Federation
- CI/CD Pipelines (GitHub Actions / GitLab CI): Exchange short-lived OIDC JWTs for temporary cloud credentials scoped strictly to a single deployment job.
If a token leaks, its blast radius is limited to minutes rather than months.
4. Isolate East-West Traffic with Default-Deny NetworkPolicies
Once an attacker lands inside a pod, flat cluster networking lets them freely probe internal databases, metadata endpoints (169.254.169.254), and adjacent microservices.
Apply a default-deny posture in every production namespace and explicitly whitelist only required egress/ingress paths:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny-all
namespace: production
spec:
podSelector: {}
policyTypes:
- Ingress
- Egress
Key Takeaway
Cloud login MFA and firewalls protect the outer shell, but cluster resilience is defined by what happens after a credential leaks. Audit your ClusterRoleBindings, eliminate static secrets, disable unnecessary service account token mounts, and treat every namespace as an untrusted network zone.
How are you managing secret rotation and workload identity across your clusters right now—Vault, External Secrets Operator, or native cloud KMS? Drop your setup in the comments.
Top comments (0)