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.

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

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

Overview

Curated: · Written: · Reviewed:

Containerization & Orchestration

In one line

A container is a process started from an image with its own namespaces and cgroups, sharing the host kernel. Kubernetes schedules Pods, and controllers keep actual state matching declared state. Reach for it when you need repeatable packaging plus self-healing, rolling change and rollback across many nodes.

Key definitions

  • Digest: the content hash of an image manifest. It pins exact bytes; a tag can move.
  • Namespace and cgroup: Linux isolation of the process view, and CPU, memory and I/O accounting and limits. The kernel is shared.
  • Pod: the scheduled unit. Its containers share a network namespace and can share volumes.
  • Requests vs limits: requests drive scheduling; limits cap runtime use.
  • Probes: startup gates the others; readiness controls Service endpoints; liveness restarts a container.
  • PodDisruptionBudget: limits voluntary evictions only, not node failure.

Formulas and complexity

CPU limits become a CFS quota per period:

quota=limit×periodquota = limit \times period

With the default 100 ms period, a 200m limit gives:

0.2×100 ms=20 ms0.2 \times 100\ \mathrm{ms} = 20\ \mathrm{ms}

The scheduler places a Pod only where the sum of requests fits allocatable. Limits play no part in that check.

How it works

kubectl apply kube-apiserver: authn, RBAC, admission etcd Deployment and ReplicaSet controllers create Pods kube-scheduler: filter, score, bind kubelet pulls digest via CRI and starts containers Probes, CNI networking, CSI volumes
  • Controllers never touch nodes. They write Pods, and the scheduler binds each Pod to a node.
  • The scheduler filters on requests, affinity, taints and topology, then scores the survivors.
  • The kubelet pulls by digest, runs probes and reports status to the API server.
  • kube-proxy programs Service rules, and it balances new TCP connections, not individual requests.
  • Under node pressure, the kubelet evicts by QoS class: BestEffort first, Guaranteed last.

When to use and when not to

NeedUseWhy
Interchangeable stateless replicas, rolling update, rollbackDeploymentReplicaSet revisions; rollback scales an older one back up
Stable names and per-replica storageStatefulSetOrdinal identity, per-replica volumes, ordered rollout
One agent per nodeDaemonSetLog shippers, CNI plugins
Run to completionJob or CronJobPod exits and is not restarted as a service
Helper that must share a volume and lifecycleSecond container in the same PodReplaced together on every rollout
Unrelated servicesSeparate PodsSeparate fate and trust boundaries

Traps interviewers probe

  1. Deploying a mutable tag. A moved tag changes what new pods pull. Fix: pin the digest in the pod template and verify the running digest after rollout.
  2. Deleting a secret in a later layer. The earlier layer keeps the bytes. Fix: RUN --mount=type=secret,id=npmrc,target=/root/.npmrc npm ci so the file never lands in a layer.
  3. Shell-form CMD. sh -c becomes PID 1 and does not forward SIGTERM, so docker stop waits 10 s and the exit code is 137. Fix: exec form, or exec node server.js inside the shell.
  4. Lowering the CPU limit to fix a slow handler. At 200m, 50 ms of CPU needs about 210 ms of wall-clock time, because only 20 ms runs per 100 ms period. Fix: size requests from measured load, then remove or raise the CPU limit and watch container_cpu_cfs_throttled_seconds_total.
  5. Liveness or readiness calling a shared dependency. A database outage then restarts every replica or empties every endpoint at once. Fix: liveness checks only local process health. Readiness checks a bounded, local condition, not a shared dependency.

Interview tips

Open by naming the layer that owns the decision: scheduler, kubelet, controller or Service proxy. Then say which signal you read first.

Follow-ups to expect:

  • Rollout stuck at 80%: readiness failing, a PDB blocking eviction, no surge capacity, image pull failure, or resource pressure. Check kubectl describe events first.
  • Request vs limit: requests are the scheduling contract; limits are the runtime cap.
  • Slow dependency: readiness catches it, and only if the check is bounded. Liveness would cascade.
  • In-flight requests on drain: SIGTERM, preStop, grace period, endpoint removal. Add a preStop sleep so endpoint removal lands before the listener closes, and set the grace period above sleep plus the longest request.
  • Tenant isolation: namespaces are administrative. Add RBAC, NetworkPolicy, ResourceQuota, and often separate nodes or clusters.

30-second outline: "This is a [layer] question. The API server records desired state, the controller creates Pods, the scheduler binds them using requests, and the kubelet pulls the digest and runs probes. I'd check the events for the owning component first, then compare against requests, allocatable or the probe result. The fix is [X], and I verify it with [the running digest, the endpoint list or the error rate]."

Feedback on this overview

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