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.

Read
46 min
Practice MCQs
25
Interview Q&A
25
Edition
v4
Editorial status
Reviewed

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

Curated: · Written: · Reviewed:

25 questions

MCQ-8A container runs as UID 1000, and its image ships a helper binary with the setuid bit set to root; the app execs that helper during startup. The team must keep the helper running but ensure it never executes with effective UID 0. Which securityContext setting enforces that?
MCQ-7A service runs in a container as UID 1000 with `--cap-drop=ALL`. It starts, then fails when it opens `/data/state.db` with `O_RDWR`: `EACCES`. `/data` is a hostPath volume mounted read-write; `/data` is mode `0755`, and `state.db` is owned by `root:root` with mode `0640`. No user-namespace remapping is in use. The team will change only the container's capability set. Which single capability, added, makes the open succeed?
MCQ-6A pod mounts the node's `/dev` through a `hostPath` volume and runs its process as UID 1000. Its security context adds `SYS_ADMIN` to the capability set but does not set `privileged: true`. A pentester with a shell inside runs `mount /dev/sda1 /mnt` to read the node's root filesystem. What does the command do?
MCQ-4A cluster runs Kubernetes v1.29 with Pod Security Admission enabled. Namespace `payments` carries the labels `pod-security.kubernetes.io/enforce: baseline` and `pod-security.kubernetes.io/enforce-version: v1.29`. The `checkout` Deployment in that namespace has 6 replicas, all Running. An engineer adds `hostNetwork: true` to the Deployment's pod template and runs `kubectl apply`. What happens?
MCQ-5A 1.31 cluster runs namespace `checkout`, which has no pod-security labels. A Deployment there holds 60 Ready replicas of a container with `hostNetwork: true`, `hostPID: true` and no `seccompProfile`, and its strategy is `maxSurge: 25%`, `maxUnavailable: 0`. An operator adds the single label `pod-security.kubernetes.io/enforce: restricted`, and in the same window the release pipeline changes the pod template's image tag, which starts a rolling update. What is the state of the Deployment a couple of minutes later?
MCQ-24Pod `pay-7c1` in namespace `prod` runs as UID 0 with `hostPID: true`, no hostPath volumes, the runtime's default seccomp profile, and `allowPrivilegeEscalation: false`. A runtime security agent alerts that the container's entrypoint ran `cat /proc/1/root/etc/shadow` and the read succeeded and returned file content. The node runs containerd 1.7.13 on kernel 5.15 with cgroup v2. What does the alert establish?
MCQ-22A CI pod runs as UID 1000 with allowPrivilegeEscalation: false, drops ALL capabilities, and mounts only the node's /var/run/docker.sock through a hostPath volume. A post-exploitation scan finds that code in the pod can read /etc/kubernetes/kubelet.conf from the node, even though the pod has no hostPath mount for /etc. Which mechanism explains the read?
MCQ-2A Deployment's pod template references `registry.example.com/api:2.7.0`. CI pushed that tag on Monday from commit a1b2c3 and again on Wednesday from commit d4e5f6. On Thursday a node was replaced; the replacement pod pulled the tag and now serves the Wednesday code while the two older pods still serve Monday's. Rolling the Deployment back to its previous revision, which also references `api:2.7.0`, does not restore Monday's code. Which change makes a rollback restore the exact bytes that ran before, whatever CI later pushes to that tag?
MCQ-3Images live in registry.internal, a plain OCI registry that also stores each image's cosign signature as a tag beside the image. A Kyverno-style admission policy on the cluster requires both a valid signature from the release team's key and a scan verdict of 0 critical CVEs for the digest being admitted. Digests are abbreviated to four hex characters. Monday 09:00 - CI builds registry.internal/payments/api:stable as digest 9f1c, signs 9f1c with the release key, and the registry's scanner records 0 critical CVEs for 9f1c. Monday 09:01 - a Deployment is applied with image registry.internal/payments/api:stable and imagePullPolicy: Always. The controller resolves the tag to 9f1c, checks the signature and the scan for 9f1c, and admits the pod. The controller only verifies; it never rewrites image references in a pod spec. Monday 09:12 - an engineer re-pushes stable from a laptop, moving the tag to digest 4a77. 4a77 is unsigned, and the registry's scanner records 2 critical CVEs for it. Monday 09:14 - the pod, still Pending while the cluster scales up a node, is scheduled onto a node with no cached copy of any image from that repository. Which outcome is correct?
MCQ-1An image `orders-api:2025.04.07` is built FROM node:20.11-bookworm-slim. CI runs `trivy image --severity HIGH,CRITICAL --ignore-unfixed --exit-code 1 orders-api:2025.04.07` and Trivy exits 0. The Deployment runs that image with `securityContext.privileged: true`, `hostPID: true`, and a hostPath mount of `/var/run/docker.sock`. In a red-team test, the operator uses `nsenter` to enter the host PID namespace and read node files. Which statement is the defensible interpretation of what the Trivy exit 0 establishes?
MCQ-17A team ships a Node service with this Dockerfile: ```dockerfile # syntax=docker/dockerfile:1 FROM node:20-alpine WORKDIR /app COPY package*.json ./ RUN npm ci COPY . . RUN --mount=type=secret,id=dbpass \ DB_PASSWORD=$(cat /run/secrets/dbpass) npm run build CMD ["node", "dist/server.js"] ``` `.dockerignore` lists `.env`, the production database password is passed as the `dbpass` build secret, and the build reads `DB_PASSWORD` from the environment without writing it to disk. The image is pushed to a private registry. A scanner pulls it and walks every layer's tar stream. What does it report?
MCQ-21payments-api is a Kubernetes Deployment of 6 pods whose pod template sets image: registry.internal/payments-api:1.14 with imagePullPolicy: IfNotPresent. A scan reports a critical CVE in the openssl package in that image's base layer, and all six nodes already have tag 1.14 in their local image cache. The team rebuilds the app on a patched base, pushes the result to registry.internal/payments-api:1.14 (overwriting the tag), re-runs kubectl apply -f payments-api.yaml with nothing else changed, and kubectl rollout status prints "successfully rolled out". Ten minutes later, what is running, and what would have to change to get the patched layers onto the pods?
MCQ-9A container runs under the runtime's default seccomp profile: default action SCMP_ACT_ERRNO(EPERM), with an allowlist that includes socket but not io_uring_setup. The application then installs its own seccomp filter, default action SCMP_ACT_ALLOW, containing one rule: socket → SCMP_ACT_ERRNO(EACCES). The app calls socket(AF_INET, SOCK_STREAM, 0) and then io_uring_setup(8, &params). What does each call return?
MCQ-10A Kubernetes Deployment runs a Go service as UID 10001 from a distroless image whose securityContext sets readOnlyRootFilesystem: true. At startup the binary creates /var/lib/pay/sessions/8f2.lock and an SQLite file in that same directory; both live in the image layer and the pod mounts no volume at that path. The container exits with code 1 after about 900 ms, the last log line reads open /var/lib/pay/sessions/8f2.lock: read-only file system, and the pod has restarted 7 times in 3 minutes. The team needs that directory writable but wants to keep the root filesystem read-only. Which change makes the startup write succeed?
MCQ-11A three-node cluster runs Flannel v0.24.0 as its only CNI plugin. In namespace `payments`, the team applies a NetworkPolicy named `deny-all` with `podSelector: {}`, `policyTypes: [Ingress]`, and no ingress rules. `kubectl get networkpolicy -n payments` shows the object, and `kubectl get pod api-0 -n payments --show-labels` confirms the pod carries the labels the selector matches. A pod in namespace `staging` still opens a TCP connection to `api-0` on port 8080. What explains the connection succeeding?
MCQ-12Cluster: three kubeadm nodes, CNI installed from the upstream flannel manifest (kube-flannel.yml). In namespace `payments` you apply a NetworkPolicy named `default-deny` with `podSelector: {}`, `policyTypes: [Ingress, Egress]`, and no rules. `kubectl get netpol -n payments` shows it; `kubectl describe` shows no events. Yet `kubectl exec` into `payments/api-0` and `curl 10.244.2.7:8080` (a pod in namespace `default`) succeeds, and a curl from that `default` pod back to `payments/api-0:8080` also succeeds. What explains the traffic?
MCQ-13Namespace `shop` runs pods labeled `app: web` that listen on 8080, fronted by a Service mapping port 80 to targetPort 8080. Namespace `edge` runs pods labeled `app: frontend`. After default-deny ingress is applied to `shop`, the team adds this policy in `shop`: ```yaml apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-frontend namespace: shop spec: podSelector: matchLabels: app: web ingress: - from: - podSelector: matchLabels: app: frontend ports: - protocol: TCP port: 8080 ``` Frontend pods in `edge` now fail with `dial tcp 10.96.14.7:80: i/o timeout`. What is the correct fix?
MCQ-15A CI service account in namespace `build` holds `create` on pods and nothing else: no `get` or `list` on any namespaced resource, no `exec`, no ability to create service accounts. A reviewer still flags the grant as privilege escalation. Why?
MCQ-14On a Kubernetes 1.29 cluster, namespace `edge` runs 26 pods. ServiceAccount `edge-sa` sets `automountServiceAccountToken: false`; the namespace's `default` ServiceAccount is left untouched. Five Deployments (4 replicas each, 20 pods) run as `edge-sa` and set no automount field. The `ingress` Deployment (4 replicas) runs as `edge-sa` and sets `automountServiceAccountToken: true` in its pod template. The `cert-renewer` CronJob (1 pod) runs as `edge-sa` and sets `automountServiceAccountToken: true` in its job template. The `log-shipper` CronJob (1 pod) sets no `serviceAccountName` and no automount field. After every workload has rolled out, how many pods have a token mounted at /var/run/secrets/kubernetes.io/serviceaccount/token?
MCQ-16A Role in namespace `payments` grants service account `system:serviceaccount:payments:ci-deployer` the verb `list` on `secrets` and nothing else; `get` is not granted anywhere. The namespace holds 12 Secrets, including `db-password`. An engineer runs: ``` kubectl get secrets -n payments --as=system:serviceaccount:payments:ci-deployer -o json ``` What does the command print?
MCQ-19A node has 8 GiB of allocatable memory. It runs payments, 3 replicas each with a memory request of 1 GiB and a limit of 2.5 GiB, steady at roughly 1 GiB per pod, plus a batch worker just redeployed with a memory request of 2 GiB and a limit of 2 GiB. The worker's known leak returns and its working set climbs past 2 GiB. What happens on that node?
MCQ-20The `checkout` Deployment runs a single container from a distroless image (no shell, no package manager). Its entrypoint execs one process at startup and nothing afterwards. The image digest is pinned in a Kyverno admission policy, the Deployment's `generation` has been 7 for six days, and `restartCount` is 0. Falco, configured to alert on any `execve` inside a container, reports 1,180 `execve` calls from that container in 90 seconds, each one `/usr/bin/curl` to a different address in 10.0.0.0/8. What does this pattern show?
MCQ-18A multi-tenant CI service runs each customer's build as a container on a shared pool of 40 nodes, about 25 builds per node, for 2,000 mutually untrusted tenants that can run arbitrary code from their repositories. A red-team exercise used a kernel bug to escape a build container and read another tenant's build secrets from node memory; the scheduler and secret-store sidecar run on those same nodes. Which change removes the demonstrated cross-tenant path at this scale?
MCQ-23A cluster runs Kyverno with a policy in Enforce mode that requires every Pod to set `resources.limits.memory`. To unblock one CronJob owned by the batch team, the platform team adds `namespaceSelector: {matchExpressions: [{key: team, operator: NotIn, values: ["batch"]}]}` to the policy. Six weeks later an audit finds 31 Pods in the `batch` namespace, 9 of them with no memory limit; the CronJob was deleted three weeks ago. What is the cause of the 9 unlimited Pods?
MCQ-25A platform team applies an admission policy on three clusters that denies pods requesting privileged mode with an image not from the internal registry. Quarter data: 12,400 pods admitted; 4,100 admission requests denied (3,900 were controllers re-applying specs of pods already running, 200 were new pods); 96% of namespaces have the baseline policy applied. At rollout, 340 running pods were privileged with untrusted images; 62 of those have since been replaced by compliant pods, and 19 new privileged untrusted pods were admitted on cluster C before the policy was applied there. Scanner findings rose from 18,400 to 21,700. The security lead defines the quarter's outcome as the net change in dangerous effective configuration. Which figure is that outcome?