✦ For everyone, free.

Practical knowledge for real and everyday life

Home

Kubernetes Cluster Security Architecture

Kubernetes Cluster Security Architecture secures containerized environments through identity, policy, and network controls.

Kubernetes Cluster Security Architecture is the arrangement of multiple, independent security layers around and within a cluster, such that a failure or bypass of any single layer does not by itself compromise the whole system, spanning the perimeter around the control plane, the request-processing pipeline within it, the isolation boundaries between workloads, and the integrity of the software supply chain that produces the images those workloads run. Rather than a single security feature, cluster security architecture is the composition of many narrowly scoped mechanisms, each addressing a distinct point of potential compromise.


Control Plane Perimeter

Securing the API Server's Exposure

The API server formally represents the cluster's primary attack surface, since it is the sole entry point through which cluster state can be read or modified; its serving certificate, network exposure (public versus private endpoint), and enabled authentication mechanisms together define the outer perimeter an attacker must first cross.

kube-apiserver --tls-cert-file=... --tls-private-key-file=... --client-ca-file=...

etcd Isolation

etcd formally holds every secret and every object's complete state; because it has no independent authentication layer comparable to the API server's, it is conventionally isolated at the network level so that only API server instances can reach it, and its data is additionally protected through encryption at rest and TLS between members.

etcd reachability = API server instances only

Request Pipeline Layers

Authentication, Authorization, Admission in Sequence

Every request formally passes through three independently configurable layers before taking effect: authentication establishes identity, authorization (commonly RBAC) determines whether that identity may perform the requested action, and admission control evaluates the specific content of the request against policy, each layer capable of independently rejecting a request the prior layer allowed.

request allowed authn succeeds authz succeeds admission succeeds

Encryption at Rest for Secrets

Beyond etcd's own network isolation, the API server can be configured with an encryption-at-rest provider so that Secret data (and optionally other resource types) is encrypted before being written to etcd, protecting against exposure through direct access to etcd's storage or backups even if network isolation is somehow bypassed.

apiVersion: apiserver.config.k8s.io/v1
kind: EncryptionConfiguration
resources:
  - resources: ["secrets"]
    providers:
      - aescbc:
          keys:
            - name: key1
              secret: <base64-encoded-key>

Workload Isolation Layers

Namespace and RBAC Boundaries

Namespaces formally provide a scoping boundary for RBAC and resource governance, limiting the blast radius of a compromised identity to whatever a single namespace's Roles grant, distinct from and layered atop the cluster-wide authorization decisions RBAC also governs.

Network Policy as Lateral Movement Control

NetworkPolicy formally restricts which Pods may communicate with which others, defaulting to fully open connectivity absent explicit rules; deliberately configuring default-deny policies with narrow, explicit allow rules limits how far an attacker who compromises one workload can move laterally to reach others.

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: default-deny
  namespace: codartium-team
spec:
  podSelector: {}
  policyTypes: ["Ingress", "Egress"]

Pod-Level Runtime Constraints

securityContext settings and Pod Security Admission profiles formally constrain what a container's process can do at the kernel level even after it starts running, an isolation layer that operates entirely independently of, and beneath, both RBAC and network policy.

defense in depth = RBAC network policy pod security admission policy

Supply Chain Considerations

Image Provenance and Verification

Security architecture formally extends beyond the running cluster to the container images it executes; image signing and admission-time signature verification (via a webhook or ValidatingAdmissionPolicy) allow a cluster to reject images that do not originate from a trusted, verifiable build pipeline before they are ever scheduled.

# Illustrative admission rule referencing image signature verification
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
  name: verify-image-signatures

Vulnerability Scanning

Scanning images for known vulnerabilities, either in the CI pipeline before an image reaches a registry or at admission time against a running cluster, forms a further layer addressing risk introduced through third-party or outdated dependencies bundled into a workload's image.

kubectl get pods -o jsonpath='{.items[*].spec.containers[*].image}' | tr ' ' '\n' | sort -u

Auditability as a Cross-Cutting Layer

The Audit Log as a Forensic Record

Independent of any preventive layer, the API server's audit log formally records every processed request, forming a cross-cutting observability layer that does not prevent compromise but enables its detection and investigation after the fact, a necessary complement to the preventive layers described above since no set of preventive controls is guaranteed complete.

apiVersion: audit.k8s.io/v1
kind: Policy
rules:
  - level: Metadata

Why Security Is Architected in Layers

No single mechanism among RBAC, network policy, Pod security, admission control, encryption at rest, or image verification is formally sufficient on its own to secure a cluster; each addresses a distinct category of risk, and their composition into independent, overlapping layers is what ensures that a gap or misconfiguration in any one layer does not, by itself, translate into a complete compromise of the cluster.