Docker and Kubernetes have become the de facto standard for deploying applications at Indian product companies. Whether you are a backend engineer being asked about containerisation in an interview, or a DevOps engineer targeting a cloud infrastructure role, this guide covers the Docker and Kubernetes interview questions you will face at Indian companies in 2026.
Docker fundamentals: images, containers, and Dockerfiles
Docker interview questions:
1. What is Docker? Docker is a containerisation platform. A Docker container is a lightweight, isolated environment that bundles an application with all its dependencies (runtime, libraries, config files) into a single portable unit called a container image. Container images run consistently across any environment (developer laptop, CI server, staging, production) that has Docker installed.
2. Key Docker concepts: - Image: a read-only template built from a Dockerfile; layers are cached for faster rebuilds - Container: a running instance of an image; isolated from the host and other containers via Linux namespaces and cgroups - Registry: a repository for Docker images; Docker Hub (public), Amazon ECR, Google Artifact Registry, or a private registry
3. Writing a Dockerfile: ```dockerfile FROM node:20-alpine WORKDIR /app COPY package*.json ./ RUN npm ci --only=production COPY . . EXPOSE 3000 CMD ["node", "server.js"] ```
Key Dockerfile instructions: FROM (base image), WORKDIR, COPY, RUN (execute commands during build), EXPOSE (document the port), CMD (default command when the container starts).
4. Multi-stage builds: Multi-stage builds reduce image size by using one stage to build the application and a separate stage to package only the compiled output: ```dockerfile FROM node:20 AS builder WORKDIR /app COPY . . RUN npm ci && npm run build
FROM node:20-alpine WORKDIR /app COPY --from=builder /app/dist ./dist COPY --from=builder /app/nodemodules ./nodemodules CMD ["node", "dist/server.js"] ```
5. Docker Compose: Docker Compose defines and runs multi-container applications. A docker-compose.yml file describes the services (web, database, cache), their images, environment variables, ports, and volumes. docker compose up starts all services; docker compose down stops and removes them. Primarily used for local development environments (not Kubernetes production deployments).
Kubernetes fundamentals: pods, deployments, and services
Kubernetes interview questions:
1. What is Kubernetes (K8s)? Kubernetes is a container orchestration platform that manages containers across a cluster of multiple machines. Kubernetes handles: scheduling (which node does this container run on?), scaling (run 10 replicas; scale to 50 when CPU > 70%), self-healing (restart crashed containers; reschedule if a node goes down), service discovery and load balancing, and rolling deployments (update to a new version with zero downtime).
2. Core Kubernetes objects: - Pod: the smallest deployable unit in Kubernetes; one or more containers that share network and storage - Deployment: manages a replica set of identical pods; handles rolling updates and rollbacks - Service: provides a stable network endpoint for a set of pods (ClusterIP for internal traffic, NodePort and LoadBalancer for external access) - ConfigMap: stores non-secret configuration data as key-value pairs; mounted as environment variables or files in pods - Secret: stores sensitive data (passwords, API keys) encrypted at rest; mounted similarly to ConfigMaps - Namespace: virtual cluster within a Kubernetes cluster; used for resource isolation (dev, staging, production namespaces)
3. The key YAML objects: ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: my-app spec: replicas: 3 selector: matchLabels: app: my-app template: metadata: labels: app: my-app spec: containers: - name: my-app image: my-registry/my-app:1.0.0 ports: - containerPort: 3000 resources: requests: memory: "128Mi" cpu: "100m" limits: memory: "256Mi" cpu: "500m" ```
4. Kubernetes vs Docker Compose: Docker Compose: runs on a single machine; great for local development; no high availability. Kubernetes: runs across a cluster of many machines; production-grade; handles node failures, auto-scaling, and rolling deployments.
Advanced Kubernetes: Ingress, HPA, and Helm
Advanced Kubernetes concepts:
1. Ingress: Ingress is a Kubernetes resource that manages external HTTP/HTTPS access to services within the cluster. An Ingress Controller (NGINX Ingress Controller, Traefik, AWS ALB Ingress Controller) implements the rules defined in Ingress objects: routing traffic to different services based on hostname (api.example.com routes to the API service; app.example.com routes to the frontend service) and path (/api/ routes to the API service; /static/ routes to the CDN or static file service).
2. Horizontal Pod Autoscaler (HPA): HPA automatically scales the number of pod replicas based on CPU utilisation, memory usage, or custom metrics. When CPU utilisation exceeds 70%, HPA adds more replicas; when it drops below the target, replicas are removed. You define: minimum replicas, maximum replicas, and the target metric threshold.
3. Liveness and readiness probes: - Liveness probe: checks if the container is running. If it fails, Kubernetes restarts the container. Use for detecting stuck processes. - Readiness probe: checks if the container is ready to receive traffic. If it fails, the pod is removed from the Service's load balancer (traffic stops being sent to it). Use for checking if the application has finished startup (database connections established, caches warmed).
4. Helm: Helm is the package manager for Kubernetes. A Helm chart is a collection of YAML templates that define a Kubernetes application. Values in a values.yaml file parameterise the templates (image tag, replica count, resource limits). helm install deploys a chart; helm upgrade updates it; helm rollback rolls it back. Widely used for deploying standard infrastructure (NGINX Ingress, Prometheus, Kafka) and for packaging your own applications for deployment across environments with different configurations.
Practise DevOps and Kubernetes interview questions with HireStepX's AI voice interviewer. Get scored feedback on your explanations of container orchestration, CI/CD, and cloud infrastructure concepts. First 2 sessions free.
Practice freeDocker and Kubernetes interview questions for DevOps roles
DevOps and SRE interview questions on Kubernetes:
1. How do you deploy a new version of an application to Kubernetes with zero downtime? Update the image tag in the Deployment spec and apply it (kubectl apply -f deployment.yaml or helm upgrade). Kubernetes performs a rolling update: new pods with the new image are started; once they are healthy (readiness probe passes), old pods are terminated; this continues until all replicas are updated. Configure: maxUnavailable: 0 (never take down a pod before a new one is healthy) and maxSurge: 1 (create one extra pod during the update).
2. How do you debug a pod that is crashing in Kubernetes? - kubectl get pods: check the pod status (CrashLoopBackOff means it is crashing and restarting repeatedly) - kubectl describe pod <pod-name>: shows events, including the reason for recent crashes - kubectl logs <pod-name> --previous: shows logs from the previous (crashed) container instance - kubectl exec -it <pod-name> -- /bin/sh: open a shell inside the running container for live debugging
3. What is a PodDisruptionBudget (PDB)? PDB ensures that a minimum number of pods remain available during voluntary disruptions (node drains, cluster upgrades). Prevents Kubernetes cluster operations from taking down more than one pod at a time for a critical service.
4. RBAC in Kubernetes: Role-Based Access Control restricts what users and service accounts can do in the cluster. Roles and ClusterRoles define permissions (verbs: get, list, watch, create, update, delete on resources: pods, deployments, secrets). RoleBindings and ClusterRoleBindings assign roles to users or service accounts. Best practice: principle of least privilege; your application's service account should only have the permissions it needs (typically: read its own ConfigMaps and Secrets, nothing else).
Frequently asked questions
Explore more