Skip to content
Tech Interview Prep
Technical interview guide

Containerization & Orchestration

Packaging an app with its dependencies via containers, and how Kubernetes schedules and manages them at scale.

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

Scope: Docker, OCI Image and Runtime specifications, and Kubernetes guidance current 2026-08-31.

Curated: · Written: · Reviewed:

25 questions

MCQ-8A payments team runs a stateless HTTP API: 12 interchangeable Pods behind a Service, no per-Pod storage, no stable network names. They need to ship a new image with no dropped requests and revert to the previous image in under a minute if error rates spike. Which controller should own these Pods?
MCQ-6A team runs a Go API server as a Deployment. A log-forwarder must read a file the API writes to a shared volume and must be replaced together with the API on every rollout. Which placement fits?
MCQ-7A Pod's application container must not start until a config file is fetched from an external service and then a schema migration runs against the database; the migration must not run if the fetch fails. Which mechanism enforces that order?
MCQ-1A team's container image is built FROM debian:bullseye (Debian 11, kernel 5.10). It runs on hosts with kernel 5.15.19, and `uname -r` inside the container prints 5.15.19. A vendor certifies the workload only on kernel 5.10. What must the team change to get the container running on 5.10?
MCQ-2A Deployment's pod template references `registry.internal/api@sha256:1111…`: a digest, not a tag. Its 4 pods pulled that content at 09:00. At 13:00 CI rebuilt the image and moved the `prod` tag to a new manifest, `sha256:2222…`; the old manifest is still in the registry. At 14:00 the Deployment is scaled to 10 replicas, and the 6 new pods are scheduled onto nodes that have never held the image. What content do the 6 new pods run?
MCQ-4A Go service is built with this Dockerfile: ```dockerfile FROM golang:1.22 AS build WORKDIR /src COPY . . RUN CGO_ENABLED=0 go build -mod=vendor -o /src/bin/api ./cmd/api FROM debian:bookworm-slim COPY --from=build /src /app ENTRYPOINT ["/app/bin/api"] ``` The repository vendors its dependencies into `vendor/`. Measured sizes: `golang:1.22` 830 MB, `debian:bookworm-slim` 75 MB, `vendor/` 250 MB, the compiled binary 12 MB, the remaining source 3 MB. `docker images` reports 340 MB for the final image, and the team needs it under 100 MB. Which change gets there?
MCQ-3A team builds this image and pushes `acme/api:1.4.0` (412 MB) to a registry: ``` FROM node:20-alpine WORKDIR /app COPY package.json package-lock.json .npmrc ./ RUN npm ci RUN rm -f .npmrc COPY src ./src ``` A scanner reports the npm token from `.npmrc` inside the pushed image. Which change makes the token absent from the pushed image?
MCQ-5A container image ends with `CMD ["/bin/sh", "-c", "node server.js"]`. The app registers a SIGTERM handler that drains in-flight requests. On every deploy, `docker stop` waits the full 10-second default timeout, the container exits with code 137, and the drain handler never runs. What explains this?
MCQ-14A single-threaded CPU-bound handler runs in a pod whose only CPU setting is resources.limits.cpu: 200m, with nothing else running in the pod. The node has 8 cores and is 15% utilized. One request needs 50 ms of actual CPU time and no I/O waits, and it arrives exactly on a CFS period boundary with the container's quota untouched. With the kernel's default CFS period, how long does that request take end to end?
MCQ-15A Java 11 service runs in a container with `resources.limits.memory: 512Mi` and no `-Xmx` flag. Under load, the live set reaches 300 MiB. The node has 16 GiB free. What happens?
MCQ-16A cluster has three nodes, each with 4 CPU allocatable. Existing pods have requested 3.6 CPU on node-1, 3.7 CPU on node-2 and 3.8 CPU on node-3, though all three nodes are actually running under 10% CPU utilization. A new pod is created with requests.cpu: 500m and limits.cpu: 2. What does the scheduler do?
MCQ-17A Deployment of app=api runs 6 replicas on a 5-node cluster: 2 nodes in zone-a, 2 in zone-b, 1 in zone-c. Every node has spare CPU and no taints. The Pod template sets requiredDuringSchedulingIgnoredDuringExecution podAntiAffinity with topologyKey: kubernetes.io/hostname and a labelSelector matching app=api. The first 5 replicas each land on a different node. What happens to the 6th replica?
MCQ-18A Deployment runs 6 replicas behind a PodDisruptionBudget with minAvailable: 4. Node node-3 hosts 3 of the pods. An operator runs kubectl drain node-3. Two of node-3's pods have been evicted and their replacements are not yet Ready, so 4 pods are Ready. The drain now asks the eviction API to evict the last pod on node-3. What happens?
MCQ-9A ClusterIP Service `web` fronts six Pods, all Ready, and `kubectl get endpoints web` lists all six Pod addresses. The Service has `sessionAffinity: None`. An in-cluster client opens one HTTP keep-alive connection and sends 10,000 requests; every request is served by pod-3. A second client opens a fresh TCP connection per request and its requests spread evenly across all six Pods. Direct requests to each Pod IP on the Service's targetPort succeed. What explains the first client's result?
MCQ-24A Deployment runs 6 replicas of a Go HTTP service behind a ClusterIP Service; requests take up to 20 s. terminationGracePeriodSeconds is 30, there is no preStop hook, and on SIGTERM the server stops accepting new connections, finishes in-flight requests, then exits. During rolling updates about 1% of requests fail with 'connection reset by peer'; the failures stop once the rollout ends. Which change removes them?
MCQ-25checkout-api runs as a Deployment with 8 replicas, maxUnavailable: 25%, maxSurge: 25%, and minReadySeconds: 10. Its readiness probe is a TCP socket check on port 8080 (periodSeconds: 5, failureThreshold: 3). `kubectl rollout status deployment/checkout-api` prints "successfully rolled out". Ten minutes later, 30% of /checkout requests return HTTP 500 while all 8 pods report Running and Ready. What does the successful rollout status establish about this failure?
MCQ-12A Java service needs about 90 seconds to load its cache before it can serve traffic. Its liveness probe is `initialDelaySeconds: 30`, `periodSeconds: 10`, `failureThreshold: 3`, so the kubelet restarts the container after three failed checks, around 50 seconds, before warm-up finishes. The team adds a startup probe with `periodSeconds: 10` and `failureThreshold: 12`. What does that change?
MCQ-10A Deployment runs 12 replicas of an API behind a Service. The readiness probe is `GET /healthz`, which returns 200 only when the pod can open a connection to the Postgres primary; the liveness probe is `GET /livez`, which returns 200 whenever the HTTP server accepts connections. During a managed failover the primary is unavailable for 75 seconds. All 12 pods fail readiness at the same moment, the Service's endpoint list empties, and the ingress returns 503 for the whole 75 seconds. No pod restarts. Which change addresses the outage?
MCQ-11A payments API runs 12 replicas behind a Service. Its liveness probe calls /healthz, which pings the primary Postgres and returns 500 when that query fails. During a 40-second Postgres failover every replica fails liveness and Kubernetes restarts all 12 Pods; the cold-start load stretches the outage to 6 minutes. What should the liveness probe decide?
MCQ-13An API Deployment runs 24 replicas. Each pod's livenessProbe is an HTTP GET to /healthz every 10 s with timeoutSeconds: 2 and failureThreshold: 3, and /healthz opens a connection to the shared Postgres primary and runs SELECT 1. The primary is failed over for 60 s and refuses new connections instantly for the whole window; nothing hangs and no query runs slowly. Every replica starts failing /healthz at t=0, all 24 containers are killed and restarted inside the same 10-second window, and Postgres accepts connections again at t=60 s, yet the API still serves no traffic for minutes afterward. Which change removes the restart storm?
MCQ-21During an incident, an engineer pastes this into a channel that includes an outside contractor who has no cluster credentials and no RBAC in the prod namespace, quoting `kubectl get secret db-creds -n prod -o yaml`: `password: czNjcjN0LXBhc3M=`. What does the pasted line give the contractor?
MCQ-19A pen-test pod runs with this securityContext: runAsNonRoot: true, runAsUser: 1000, runAsGroup: 3000, allowPrivilegeEscalation: false, readOnlyRootFilesystem: true, capabilities: {drop: ["ALL"]}, seccompProfile: {type: RuntimeDefault}. The spec mounts no hostPath volumes and leaves automountServiceAccountToken unset. The pod's service account is bound to a Role granting list on secrets in the namespace. The image is a standard Debian base, where /etc/shadow is mode 0640 root:shadow. The tester gets code execution as the app process. Which of these does that process actually accomplish?
MCQ-22A cluster runs Kubernetes v1.29. In namespace `metrics`, ServiceAccount `reporter` is bound two ways: a RoleBinding in `metrics` references ClusterRole `pod-reader` (verbs get, list, watch on pods), and a ClusterRoleBinding references ClusterRole `secret-reader` (verbs get, list on secrets). An attacker gets code execution in a Pod running as `reporter` and reads the projected token at /var/run/secrets/kubernetes.io/serviceaccount/token. Using only that token, what can the attacker read?
MCQ-20A CI runner Pod mounts the node's /var/run/docker.sock so its build step can run `docker build`, and that step works today. The Pod runs as UID 1000, drops all capabilities, sets readOnlyRootFilesystem, and its namespace has a default-deny NetworkPolicy. A contributor adds a step that runs `docker run --privileged -v /:/host alpine chroot /host cat /etc/shadow`. What happens when the pipeline runs?
MCQ-23A team's CI pipeline runs `trivy image --severity HIGH,CRITICAL --exit-code 1` on the image it just built; the scan reports no findings and the image is deployed. At runtime the container reads its database password from an environment variable injected by the orchestrator, mounts a ConfigMap, and calls an internal payment API. Which claim does that passing scan not support?