INTERVIEW PREP
Interview questions
570 questions from real DevOps, SRE, platform engineering and MLOps interviews, with the answer an interviewer wants to hear. Try answering out loud first, then open the model answer.
Showing 166–180 of 490 questions
166.What actually isolates a container from the host?SeniorDocker
Linux namespaces (PID, network, mount, UTS, IPC, user) isolate what it sees; cgroups limit what it uses; seccomp, capabilities and AppArmor/SELinux limit what it can do. It shares the host kernel, so kernel exploits can escape; gVisor or Kata add a stronger boundary.
167.Why should a container run one main process, and what is PID 1's job?SeniorDocker
Docker watches PID 1: when it exits, the container stops. PID 1 must handle signals and reap zombie processes; many apps don't, so use exec in entrypoint scripts or --init (tini). One process per container also keeps logs, scaling and restarts simple.
168.What are cgroups and namespaces?SeniorDocker
Namespaces give a container its own view of processes, network, mounts, hostname and users. Cgroups limit and measure its CPU, memory and I/O. Together they make a container: an isolated, limited process on a shared kernel.
169.How do you choose a base image?SeniorDocker
Prefer small, maintained images: distroless or -slim variants, or Alpine if musl is fine for your app. Pin versions or digests, rebuild often to pick up security fixes, and scan images in CI.
170.What is the difference between Docker and containerd, and why did Kubernetes drop dockershim?SeniorDocker
containerd is the container runtime that actually runs containers; Docker Engine adds a CLI, builds and more on top of it. Kubernetes talks to runtimes through CRI, which containerd and CRI-O support directly, so the extra Docker layer (dockershim) was removed in 1.24. Images built with Docker still run unchanged.
171.What is the difference between a Deployment, a ReplicaSet and a Pod?BeginnerKubernetes
A Pod runs one or more containers. A ReplicaSet keeps a number of identical Pods running. A Deployment manages ReplicaSets to give rolling updates and rollbacks; you normally only create Deployments.
172.How does a Service find its Pods?BeginnerKubernetes
Through its label selector. The endpoints controller lists ready Pods whose labels match, and kube-proxy (or the CNI) routes the Service's virtual IP to them.
173.What are the main parts of a Kubernetes cluster?BeginnerKubernetes
The control plane runs the API server, etcd (the database), the scheduler and the controller manager. Each worker node runs kubelet, a container runtime and kube-proxy (or a CNI that replaces it). You talk to the API server with kubectl.
174.What is a namespace used for?BeginnerKubernetes
It groups resources inside one cluster, for example per team or environment, and is the unit for RBAC, resource quotas and network policies. It is not a hard security boundary on its own.
175.What is the difference between a ConfigMap and a Secret?BeginnerKubernetes
Both hold configuration for Pods. Secrets are meant for sensitive data and are base64-encoded, not encrypted by default; turn on encryption at rest and limit access with RBAC, or use an external secret manager.
176.What are the Service types?BeginnerKubernetes
ClusterIP (internal only, the default), NodePort (a port on every node), LoadBalancer (a cloud load balancer) and ExternalName (a DNS alias). Ingress or Gateway API sit on top to route HTTP by host and path.
177.A Pod is in CrashLoopBackOff. How do you debug it?MidKubernetes
kubectl describe pod for events and the last state, kubectl logs pod --previous for the crashed container's output, check probes, config and resources, and use kubectl debug for an ephemeral shell if the image has none.
178.What is the difference between liveness and readiness probes?MidKubernetes
Readiness decides whether a Pod receives traffic; failing removes it from Service endpoints. Liveness decides whether to restart the container. A too-strict liveness probe causes restart loops under load.
179.What do resource requests and limits do?MidKubernetes
Requests are what the scheduler reserves and decide which node a Pod fits on. Limits cap usage: exceeding the memory limit gets the container OOM-killed, exceeding CPU gets it throttled.
180.A Pod is stuck in Pending. What do you check?MidKubernetes
kubectl describe pod shows the events. Common causes: not enough CPU or memory for its requests, taints without tolerations, node selectors or affinity that match no node, or a PersistentVolumeClaim that can't be bound.