Skip to content
Tech Interview Prep
Technical interview guide

Container & Workload Security

Securing what runs inside containers and the runtime environment around them: images, runtime behavior, and isolation.

Minutes to read
4
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed

Scope: Kubernetes v1.37 documentation and NIST SP 800-190 guidance current 2026-08-31.

Overview

Curated: · Written: · Reviewed:

Container & Workload Security

In one line

A container is a namespaced process on the host kernel, so I layer controls across the lifecycle (image, admission, runtime, identity, network, detection) because no single stage stops a compromised process. I reach for this framing whenever asked how to build, admit and run workloads safely on Kubernetes.

Key definitions

  • Digest: the sha256 hash of image content. It is the only image reference that cannot be re-pointed; tags are mutable metadata.
  • SBOM: a package inventory (SPDX or CycloneDX) that answers exposure questions without rescanning.
  • Provenance (SLSA attestation): evidence that a named pipeline built this digest from a given source revision.
  • Pod Security Admission: namespace-label enforcement of the privileged, baseline and restricted levels, in enforce, audit or warn mode.
  • Reachability: whether a vulnerable package is loaded or executed at runtime. It outranks raw CVSS in triage.
  • Drift: a running binary that differs from the image admission approved.

How it works

  • The kernel is shared, so a privileged or escaped process reaches the node and every pod on it.
  • CI scans and signs the image digest. Admission checks the signature and policy against the digest the kubelet will actually run.
  • Runtime controls shrink what a compromised process can do: non-root UID, dropped capabilities, allowPrivilegeEscalation false, read-only root filesystem, RuntimeDefault seccomp.
  • Identity and network cut the next rungs: no token mounted unless needed, default-deny NetworkPolicy on a CNI that enforces it.
Source and dependencies Build and scan final image Sign and attest digest Registry: digest is the release identity Admission: signature, scan, PSA Runtime: securityContext, seccomp, NetworkPolicy Detection: Falco-class rules

When to use and when not to

DecisionUse it forDoes not establish, or choose instead
Trivy exit 0No fixable HIGH/CRITICAL matches in the scanner's data at scan timeSafe configuration, privilege, hostPath or runtime behavior
Deploy by tagHuman-readable labelsRelease identity: deploy by digest
Shared nodes for mutually untrusted tenantsOnly with hardening in placeDedicated nodes or clusters, or a sandboxed RuntimeClass
NetworkPolicyLayer 3/4 segmentation, if the CNI enforces itAuthentication or encryption: use mTLS or a mesh
readOnlyRootFilesystemBlocks writes into image layersWritable emptyDir or PVC mounts for the paths that need them
Distroless baseSmaller CVE surface, no shell for an attackerEphemeral debug containers for operators

Traps interviewers probe

  1. Reading Trivy exit 0 as safety. Fix: state it narrowly, as no fixable HIGH/CRITICAL matches at scan time. Then check privileged mode, hostPath, hostPID and runtime detection separately.
  2. Pinning a tag for immutability. Fix: deploy by digest and roll back to the digest that ran. A tag re-pushed by CI, or reused under IfNotPresent with a warm node cache, runs whatever it last pointed to.
  3. Assuming NetworkPolicy is enforced. Fix: confirm the CNI implements it. Flannel does not, so an accepted policy gives no isolation. Prove it with a connection that must fail.
  4. Forgetting the namespace in a policy peer. A podSelector alone matches pods in the policy's own namespace. Fix: put a namespaceSelector in the same from element to match pods in another namespace. Ports apply to the pod port after Service targetPort translation.
  5. Treating Secrets as protected. Secret data is base64 unless etcd encryption at rest is on, and a list verb returns the full objects. Fix: restrict get, list and watch on secrets, restrict pod creation that can mount them, and enable etcd encryption.

Interview tips

Open with: "Containers share the host kernel, so I control what gets built, admitted, run with least privilege, reachable on the network, and detected, and I deploy by digest."

Follow-ups to expect:

  • How does admission verify a signature, and what does the signature not prove?
  • A base image CVE lands. What do you do in the first day?
  • Can a pod that can create pods escalate? Through which mounted secrets, service accounts or privileged settings?
  • How do you move existing namespaces to restricted? Set warn and audit labels, fix flagged pods, then enforce. Running pods keep running, but new ones and template changes get rejected.
  • When do you need a sandboxed RuntimeClass?

30-second answer outline:

  1. Threat: shared kernel, and the lateral path pod, service account, API server, node, cloud credentials.
  2. Build: minimal base, no secrets in layers, scan, SBOM, sign the digest with provenance.
  3. Admit: verify signature and digest, enforce restricted PSA.
  4. Run: non-root, dropped capabilities, read-only root, RuntimeDefault seccomp, no token unless needed, default-deny NetworkPolicy on an enforcing CNI.
  5. Detect and respond: runtime rules, then replace the workload from a known-good digest rather than cleaning it.

Feedback on this overview

Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.