Kubernetes Interview Master

The ultimate collection of 100+ meticulously curated Kubernetes & Container Orchestration questions to help you ace your DevOps interview.

0 / 100+ Learnedkubectl & ArchitectureNetworking & Storage
Showing 100 results in All Questions category.
1
What is Kubernetes?
Beginner

Kubernetes (K8s) is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications.

Comprehensive Explanation
Kubernetes (K8s) is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications.
Beginner
2
Why do we need Kubernetes?
Beginner

As applications grew from single monoliths to microservices, managing thousands of containers manually became impossible. Kubernetes provides a framework to run...

Comprehensive Explanation
As applications grew from single monoliths to microservices, managing thousands of containers manually became impossible. Kubernetes provides a framework to run distributed systems resiliently, handling failovers, scaling, and load balancing automatically.
Beginner
3
What are the main components of Kubernetes Architecture?
Beginner

Kubernetes follows a client-server architecture. It has a control plane (Master Node) consisting of kube-apiserver, etcd, kube-scheduler, and kube-controller-ma...

Comprehensive Explanation
Kubernetes follows a client-server architecture. It has a control plane (Master Node) consisting of kube-apiserver, etcd, kube-scheduler, and kube-controller-manager. It also has Worker Nodes consisting of kubelet, kube-proxy, and a container runtime.
Beginner
4
What is a Pod?
Beginner

A Pod is the smallest and simplest execution unit in Kubernetes. It encapsulates one or more containers, storage resources, a unique network IP, and options tha...

Comprehensive Explanation
A Pod is the smallest and simplest execution unit in Kubernetes. It encapsulates one or more containers, storage resources, a unique network IP, and options that govern how the container(s) should run.
Beginner
5
What is a Node in Kubernetes?
Beginner

A Node is a worker machine in Kubernetes (previously known as a minion). It may be a VM or a physical machine, depending on the cluster. Each node contains the ...

Comprehensive Explanation
A Node is a worker machine in Kubernetes (previously known as a minion). It may be a VM or a physical machine, depending on the cluster. Each node contains the services necessary to run Pods, managed by the control plane.
Beginner
6
What is kubelet?
Beginner

The kubelet is the primary 'node agent' that runs on each worker node. It registers the node with the apiserver and ensures that containers described in PodSpec...

Comprehensive Explanation
The kubelet is the primary 'node agent' that runs on each worker node. It registers the node with the apiserver and ensures that containers described in PodSpecs are running and healthy.
Beginner
7
What is kube-proxy?
Beginner

kube-proxy is a network proxy that runs on each node in your cluster, implementing part of the Kubernetes Service concept. It maintains network rules on nodes, ...

Comprehensive Explanation
kube-proxy is a network proxy that runs on each node in your cluster, implementing part of the Kubernetes Service concept. It maintains network rules on nodes, allowing network communication to your Pods.
Beginner
8
What is the role of kube-apiserver?
Beginner

The API server is the front end for the Kubernetes control plane. It exposes the Kubernetes API, handles REST operations, and provides the frontend to the clust...

Comprehensive Explanation
The API server is the front end for the Kubernetes control plane. It exposes the Kubernetes API, handles REST operations, and provides the frontend to the cluster's shared state through which all other components interact.
Beginner
9
What is etcd?
Beginner

etcd is a consistent, highly-available key-value store used as Kubernetes' backing store for all cluster data. It holds the desired state and current state of t...

Comprehensive Explanation
etcd is a consistent, highly-available key-value store used as Kubernetes' backing store for all cluster data. It holds the desired state and current state of the entire cluster.
Beginner
10
What is kube-scheduler?
Beginner

The scheduler watches for newly created Pods that have no Node assigned. For every unassigned Pod, the scheduler finds the best Node for that Pod to run on base...

Comprehensive Explanation
The scheduler watches for newly created Pods that have no Node assigned. For every unassigned Pod, the scheduler finds the best Node for that Pod to run on based on resource requirements, constraints, and policies.
Beginner
11
What is a ReplicaSet?
Beginner

A ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time. It guarantees the availability of a specified number of identical ...

Comprehensive Explanation
A ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time. It guarantees the availability of a specified number of identical Pods.
Beginner
12
What is a Deployment in Kubernetes?
Beginner

A Deployment provides declarative updates for Pods and ReplicaSets. You describe a desired state in a Deployment, and the Deployment Controller changes the actu...

Comprehensive Explanation
A Deployment provides declarative updates for Pods and ReplicaSets. You describe a desired state in a Deployment, and the Deployment Controller changes the actual state to the desired state at a controlled rate (e.g., for rolling updates).
Beginner
13
What is a Kubernetes Service?
Beginner

A Service is an abstract way to expose an application running on a set of Pods as a network service. It provides a stable IP address and DNS name to access the ...

Comprehensive Explanation
A Service is an abstract way to expose an application running on a set of Pods as a network service. It provides a stable IP address and DNS name to access the dynamically changing Pod IPs.
Beginner
14
What are the different types of Kubernetes Services?
Beginner

The main types are: ClusterIP (default, internal only), NodePort (exposes on each Node's IP at a static port), LoadBalancer (provisions a cloud provider's load ...

Comprehensive Explanation
The main types are: ClusterIP (default, internal only), NodePort (exposes on each Node's IP at a static port), LoadBalancer (provisions a cloud provider's load balancer), and ExternalName (maps the Service to a DNS name).
Beginner
15
What are Namespaces?
Beginner

Namespaces provide a mechanism for isolating groups of resources within a single cluster. They are intended for use in environments with many users spread acros...

Comprehensive Explanation
Namespaces provide a mechanism for isolating groups of resources within a single cluster. They are intended for use in environments with many users spread across multiple teams or projects (like resource quotas).
Beginner
16
What is kubectl?
Beginner

kubectl is the command-line tool for interacting with the Kubernetes API server. It allows you to run commands against Kubernetes clusters to deploy apps, inspe...

Comprehensive Explanation
kubectl is the command-line tool for interacting with the Kubernetes API server. It allows you to run commands against Kubernetes clusters to deploy apps, inspect and manage cluster resources, and view logs.
Beginner
17
How do you view all pods in the default namespace?
Beginner

You use the `kubectl get pods` command.

Comprehensive Explanation
You use the `kubectl get pods` command.
Command / Code
kubectl get pods
Beginner
18
How do you view pods across all namespaces?
Beginner

You use the `--all-namespaces` or `-A` flag.

Comprehensive Explanation
You use the `--all-namespaces` or `-A` flag.
Command / Code
kubectl get pods -A
Beginner
19
What is a Container Runtime?
Beginner

The container runtime is the software that is responsible for running containers. Kubernetes supports several runtimes: containerd, CRI-O, and any implementatio...

Comprehensive Explanation
The container runtime is the software that is responsible for running containers. Kubernetes supports several runtimes: containerd, CRI-O, and any implementation of the Kubernetes CRI (Container Runtime Interface).
Beginner
20
What is Minikube?
Beginner

Minikube is a tool that allows you to run a single-node Kubernetes cluster locally on your personal computer (including Windows, macOS, and Linux PCs) so that y...

Comprehensive Explanation
Minikube is a tool that allows you to run a single-node Kubernetes cluster locally on your personal computer (including Windows, macOS, and Linux PCs) so that you can try out Kubernetes or develop with it daily.
Beginner
21
What is a DaemonSet?
Beginner

A DaemonSet ensures that a copy of a Pod runs on all (or some) Nodes in the cluster. As nodes are added to the cluster, Pods are added to them. It is typically ...

Comprehensive Explanation
A DaemonSet ensures that a copy of a Pod runs on all (or some) Nodes in the cluster. As nodes are added to the cluster, Pods are added to them. It is typically used for cluster storage daemons or log collection daemons.
Beginner
22
What is a StatefulSet?
Beginner

StatefulSet is the workload API object used to manage stateful applications. It manages the deployment and scaling of a set of Pods, and provides guarantees abo...

Comprehensive Explanation
StatefulSet is the workload API object used to manage stateful applications. It manages the deployment and scaling of a set of Pods, and provides guarantees about the ordering and uniqueness of these Pods (sticky identity).
Beginner
23
What are Labels and Selectors?
Beginner

Labels are key/value pairs attached to objects, such as pods, used to specify identifying attributes. Label Selectors are the core grouping primitive in Kuberne...

Comprehensive Explanation
Labels are key/value pairs attached to objects, such as pods, used to specify identifying attributes. Label Selectors are the core grouping primitive in Kubernetes, allowing the user/system to identify a set of objects.
Beginner
24
What is a ConfigMap?
Beginner

A ConfigMap is an API object used to store non-confidential data in key-value pairs. Pods can consume ConfigMaps as environment variables, command-line argument...

Comprehensive Explanation
A ConfigMap is an API object used to store non-confidential data in key-value pairs. Pods can consume ConfigMaps as environment variables, command-line arguments, or as configuration files in a volume.
Beginner
25
What is a Secret in Kubernetes?
Beginner

A Secret is an object that contains a small amount of sensitive data such as a password, a token, or a key. This allows you to manage sensitive information sepa...

Comprehensive Explanation
A Secret is an object that contains a small amount of sensitive data such as a password, a token, or a key. This allows you to manage sensitive information separately from pod specifications or container images.
Beginner
26
How does a Rolling Update work in deployments?
Intermediate

A Rolling Update allows Deployments' update to take place with zero downtime by incrementally replacing Pods instances with new ones. The new Pods are scheduled...

Comprehensive Explanation
A Rolling Update allows Deployments' update to take place with zero downtime by incrementally replacing Pods instances with new ones. The new Pods are scheduled on Nodes with available resources.
Intermediate
27
What is an Ingress in Kubernetes?
Intermediate

Ingress is an API object that manages external access to the services in a cluster, typically HTTP/HTTPS. It provides load balancing, SSL termination, and name-...

Comprehensive Explanation
Ingress is an API object that manages external access to the services in a cluster, typically HTTP/HTTPS. It provides load balancing, SSL termination, and name-based virtual hosting.
Intermediate
28
What is an Ingress Controller?
Intermediate

An Ingress controller is responsible for fulfilling the Ingress, usually with a load balancer (like NGINX or HAProxy). Unlike other controllers that run as part...

Comprehensive Explanation
An Ingress controller is responsible for fulfilling the Ingress, usually with a load balancer (like NGINX or HAProxy). Unlike other controllers that run as part of the kube-controller-manager, Ingress controllers are not started automatically with a cluster.
Intermediate
29
Explain Liveness and Readiness Probes.
Intermediate

A Liveness probe checks if a container is running. If it fails, kubelet kills the container and it is subject to its restart policy. A Readiness probe checks if...

Comprehensive Explanation
A Liveness probe checks if a container is running. If it fails, kubelet kills the container and it is subject to its restart policy. A Readiness probe checks if a container is ready to respond to requests. If it fails, the endpoints controller removes the Pod's IP from the endpoints of all Services.
Intermediate
30
What is a Job in Kubernetes?
Intermediate

A Job creates one or more Pods and ensures that a specified number of them successfully terminate. It tracks successful completions. When a specified number of ...

Comprehensive Explanation
A Job creates one or more Pods and ensures that a specified number of them successfully terminate. It tracks successful completions. When a specified number of successful completions is reached, the task (ie, Job) is complete.
Intermediate
31
What is a CronJob?
Intermediate

A CronJob creates Jobs on a repeating schedule. It is meant for performing regular scheduled actions such as backups, report generation, etc., similar to the `c...

Comprehensive Explanation
A CronJob creates Jobs on a repeating schedule. It is meant for performing regular scheduled actions such as backups, report generation, etc., similar to the `cron` utility in Linux.
Intermediate
32
What is Role-Based Access Control (RBAC)?
Intermediate

RBAC is a method of regulating access to computer or network resources based on the roles of individual users within an enterprise. In Kubernetes, it uses Role,...

Comprehensive Explanation
RBAC is a method of regulating access to computer or network resources based on the roles of individual users within an enterprise. In Kubernetes, it uses Role, ClusterRole, RoleBinding, and ClusterRoleBinding resources.
Intermediate
33
What is the difference between a Role and a ClusterRole?
Intermediate

A Role always sets permissions within a particular namespace; when you create a Role, you have to specify the namespace it belongs in. A ClusterRole, by contras...

Comprehensive Explanation
A Role always sets permissions within a particular namespace; when you create a Role, you have to specify the namespace it belongs in. A ClusterRole, by contrast, is a non-namespaced resource.
Intermediate
34
What is a Persistent Volume (PV)?
Intermediate

A PersistentVolume (PV) is a piece of storage in the cluster that has been provisioned by an administrator or dynamically via Storage Classes. It is an abstract...

Comprehensive Explanation
A PersistentVolume (PV) is a piece of storage in the cluster that has been provisioned by an administrator or dynamically via Storage Classes. It is an abstract storage resource whose lifecycle is independent of any individual Pod.
Intermediate
35
What is a Persistent Volume Claim (PVC)?
Intermediate

A PersistentVolumeClaim (PVC) is a request for storage by a user. It is similar to a Pod (Pods consume node resources, PVCs consume PV resources). PVCs can requ...

Comprehensive Explanation
A PersistentVolumeClaim (PVC) is a request for storage by a user. It is similar to a Pod (Pods consume node resources, PVCs consume PV resources). PVCs can request specific size and access modes.
Intermediate
36
What are Storage Classes?
Intermediate

A StorageClass provides a way for administrators to describe the "classes" of storage they offer. It enables dynamic provisioning of PersistentVolumes. When a P...

Comprehensive Explanation
A StorageClass provides a way for administrators to describe the "classes" of storage they offer. It enables dynamic provisioning of PersistentVolumes. When a PVC requests a specific class, the provisioner dynamically creates the PV.
Intermediate
37
What is Helm in the context of Kubernetes?
Intermediate

Helm is a package manager for Kubernetes. Helm uses a packaging format called charts (a collection of files that describe a related set of Kubernetes resources)...

Comprehensive Explanation
Helm is a package manager for Kubernetes. Helm uses a packaging format called charts (a collection of files that describe a related set of Kubernetes resources) to define, install, and upgrade even the most complex Kubernetes applications.
Intermediate
38
Explain Horizontal Pod Autoscaler (HPA).
Intermediate

HPA automatically updates a workload resource (like a Deployment or StatefulSet), aiming to automatically scale the workload to match demand based on observed C...

Comprehensive Explanation
HPA automatically updates a workload resource (like a Deployment or StatefulSet), aiming to automatically scale the workload to match demand based on observed CPU utilization or custom metrics.
Intermediate
39
What is the Cluster Autoscaler?
Intermediate

The Cluster Autoscaler automatically adjusts the size of the Kubernetes cluster (adding or removing nodes) when there are pods that failed to run due to insuffi...

Comprehensive Explanation
The Cluster Autoscaler automatically adjusts the size of the Kubernetes cluster (adding or removing nodes) when there are pods that failed to run due to insufficient resources, or when nodes are underutilized.
Intermediate
40
What is a Headless Service?
Intermediate

A Headless Service is a service where `clusterIP` is set to `None`. It does not allocate an IP address or provide load balancing. Instead, it allows direct acce...

Comprehensive Explanation
A Headless Service is a service where `clusterIP` is set to `None`. It does not allocate an IP address or provide load balancing. Instead, it allows direct access to the Pods behind it returning multiple A records via DNS. Commonly used with StatefulSets.
Intermediate
41
What are Taints and Tolerations?
Intermediate

Taints allow a node to repel a set of pods (node says "don't schedule here"). Tolerations are applied to pods, and allow them to schedule onto nodes with matchi...

Comprehensive Explanation
Taints allow a node to repel a set of pods (node says "don't schedule here"). Tolerations are applied to pods, and allow them to schedule onto nodes with matching taints.
Intermediate
42
What is Node Affinity?
Intermediate

Node affinity is a set of rules used by the scheduler to determine where a pod can be placed. It allows you to constrain which nodes your pod is eligible to be ...

Comprehensive Explanation
Node affinity is a set of rules used by the scheduler to determine where a pod can be placed. It allows you to constrain which nodes your pod is eligible to be scheduled on based on node labels (e.g., "run on nodes with label gpu=true").
Intermediate
43
What is Pod Affinity/Anti-Affinity?
Intermediate

These allow you to constrain which nodes your pod is eligible to be scheduled on based on labels on *other pods* that are already running on the node, rather th...

Comprehensive Explanation
These allow you to constrain which nodes your pod is eligible to be scheduled on based on labels on *other pods* that are already running on the node, rather than based on labels on nodes. Anti-affinity prevents pods of the same type from colocation.
Intermediate
44
What is an Init Container?
Intermediate

Init containers are specialized containers that run before app containers in a Pod. They can contain utilities or setup scripts not present in an app image. The...

Comprehensive Explanation
Init containers are specialized containers that run before app containers in a Pod. They can contain utilities or setup scripts not present in an app image. They must run to completion before the next init container or app container starts.
Intermediate
45
What is a Service Account?
Intermediate

A Service Account provides an identity for processes that run in a Pod. When you access the cluster (e.g., using kubectl), you are authenticated by the apiserve...

Comprehensive Explanation
A Service Account provides an identity for processes that run in a Pod. When you access the cluster (e.g., using kubectl), you are authenticated by the apiserver as a particular User Account. Processes in containers inside pods can authenticate as a specific ServiceAccount.
Intermediate
46
How does resource limits and requests work?
Intermediate

Requests specify the minimum resources guaranteed for a container. The scheduler uses requests to find a node. Limits specify the maximum resources a container ...

Comprehensive Explanation
Requests specify the minimum resources guaranteed for a container. The scheduler uses requests to find a node. Limits specify the maximum resources a container can use. If it exceeds Memory limit, it is OOMKilled. If it exceeds CPU limit, it is throttled.
Intermediate
47
What is a Multi-container Pod?
Intermediate

A Pod that houses multiple tightly coupled containers sharing resources (like network namespace and volumes). Common patterns include sidecar (e.g., logging age...

Comprehensive Explanation
A Pod that houses multiple tightly coupled containers sharing resources (like network namespace and volumes). Common patterns include sidecar (e.g., logging agent), adapter, and ambassador patterns.
Intermediate
48
What is the pause container in a Pod?
Intermediate

In Kubernetes, the pause container (sometimes called the infra container) serves as the 'parent container' for all containers in a Pod. Its primary roles are to...

Comprehensive Explanation
In Kubernetes, the pause container (sometimes called the infra container) serves as the 'parent container' for all containers in a Pod. Its primary roles are to hold the network namespace and IPC namespace, allowing other containers to share them.
Intermediate
49
How do you rollback a Deployment?
Intermediate

You can use the `kubectl rollout undo` command to rollback a deployment to a previous revision/state.

Comprehensive Explanation
You can use the `kubectl rollout undo` command to rollback a deployment to a previous revision/state.
Command / Code
kubectl rollout undo deployment/my-deployment
Intermediate
50
What is Kubeadm?
Intermediate

kubeadm is a tool built to provide `kubeadm init` and `kubeadm join` as best-practice "fast paths" for creating Kubernetes clusters. It performs the actions nec...

Comprehensive Explanation
kubeadm is a tool built to provide `kubeadm init` and `kubeadm join` as best-practice "fast paths" for creating Kubernetes clusters. It performs the actions necessary to get a minimum viable, secure cluster up and running.
Intermediate
51
What is the Control Plane failure impact?
Advanced

If the control plane fails, you cannot deploy new Pods, scale applications, or change the cluster state. However, the existing Pods on worker nodes will continu...

Comprehensive Explanation
If the control plane fails, you cannot deploy new Pods, scale applications, or change the cluster state. However, the existing Pods on worker nodes will continue to run and serve traffic as long as they don't crash.
Advanced
52
Explain the role of Mutating and Validating Admission Controllers.
Advanced

Admission controllers intercept requests to the API server prior to persistence. Mutating controllers may modify the objects they admit (e.g., injecting sidecar...

Comprehensive Explanation
Admission controllers intercept requests to the API server prior to persistence. Mutating controllers may modify the objects they admit (e.g., injecting sidecars). Validating controllers may reject requests to enforce custom policies.
Advanced
53
How does Kubernetes implement Service Discovery internally?
Advanced

Kubernetes uses CoreDNS (by default). When a Service is created, a DNS record is created (e.g., `my-svc.my-namespace.svc.cluster.local`). Pods can resolve this ...

Comprehensive Explanation
Kubernetes uses CoreDNS (by default). When a Service is created, a DNS record is created (e.g., `my-svc.my-namespace.svc.cluster.local`). Pods can resolve this name to the Service's ClusterIP. The kube-proxy then handles routing the ClusterIP to actual Pod IPs.
Advanced
54
What are Custom Resource Definitions (CRDs)?
Advanced

The CRD API allows you to create custom resources. They are extensions of the Kubernetes API. Once you install a CRD in the cluster, the API server handles the ...

Comprehensive Explanation
The CRD API allows you to create custom resources. They are extensions of the Kubernetes API. Once you install a CRD in the cluster, the API server handles the lifecycle of the custom resource, allowing you to use kubectl to interact with them.
Advanced
55
What is the Kubernetes Operator Pattern?
Advanced

Operators are software extensions to Kubernetes that make use of custom resources (CRDs) to manage applications and their components. They encapsulate human ope...

Comprehensive Explanation
Operators are software extensions to Kubernetes that make use of custom resources (CRDs) to manage applications and their components. They encapsulate human operational knowledge into a programmatic controller that watches the state of custom resources and acts.
Advanced
56
Explain Network Policies.
Advanced

By default, pods are non-isolated (they accept traffic from any source). NetworkPolicies allow you to specify how a pod is allowed to communicate with various n...

Comprehensive Explanation
By default, pods are non-isolated (they accept traffic from any source). NetworkPolicies allow you to specify how a pod is allowed to communicate with various network "entities" (other pods, namespaces, IP blocks) over the network, effectively acting as a firewall inside the cluster.
Advanced
57
What is priority and preemption in Kubernetes?
Advanced

Pod Priority enables you to indicate the importance of a Pod relative to other Pods via PriorityClasses. Preemption is the mechanism where the scheduler evicts ...

Comprehensive Explanation
Pod Priority enables you to indicate the importance of a Pod relative to other Pods via PriorityClasses. Preemption is the mechanism where the scheduler evicts lower-priority Pods from a Node so that a higher-priority Pod can be scheduled there if resources are exhausted.
Advanced
58
What happens during a graceful pod termination?
Advanced

1. The pod state is set to Terminating. 2. PreStop hook (if defined) executes. 3. SIGTERM is sent to the main process in each container. 4. Simultaneously, the ...

Comprehensive Explanation
1. The pod state is set to Terminating. 2. PreStop hook (if defined) executes. 3. SIGTERM is sent to the main process in each container. 4. Simultaneously, the pod is removed from the Service's endpoints. 5. After the `terminationGracePeriodSeconds` (default 30s), SIGKILL is sent.
Advanced
59
What is a PodDisruptionBudget (PDB)?
Advanced

A PDB limits the number of Pods of a replicated application that are down simultaneously from voluntary disruptions (like node draining during upgrades). It ens...

Comprehensive Explanation
A PDB limits the number of Pods of a replicated application that are down simultaneously from voluntary disruptions (like node draining during upgrades). It ensures that at least a certain number or percentage of pods remain available.
Advanced
60
How do you achieve zero downtime during Node upgrades?
Advanced

You cordon the node (marking it unschedulable). Then you drain the node (`kubectl drain`), which safely evicts all pods (respecting PDBs). High-availability dep...

Comprehensive Explanation
You cordon the node (marking it unschedulable). Then you drain the node (`kubectl drain`), which safely evicts all pods (respecting PDBs). High-availability deployments (ReplicaSets/Deployments) will recreate the pods on other available nodes.
Advanced
61
What is the Container Network Interface (CNI)?
Advanced

CNI is a Cloud Native Computing Foundation project containing specifications and libraries for writing plugins to configure network interfaces in Linux containe...

Comprehensive Explanation
CNI is a Cloud Native Computing Foundation project containing specifications and libraries for writing plugins to configure network interfaces in Linux containers. Kubernetes relies on CNI plugins (like Calico, Flannel, Cilium) to provide Pod networking.
Advanced
62
What is the Container Storage Interface (CSI)?
Advanced

CSI is a standard for exposing arbitrary block and file storage storage systems to containerized workloads on Kubernetes. It moves storage volume plugins out of...

Comprehensive Explanation
CSI is a standard for exposing arbitrary block and file storage storage systems to containerized workloads on Kubernetes. It moves storage volume plugins out of the in-tree Kubernetes codebase, allowing storage providers to develop drivers independently.
Advanced
63
What is etcd backup and why is it critical?
Advanced

etcd holds the entire cluster state. If etcd is lost without a backup, the cluster is irrecoverable. Backing up etcd requires using `etcdctl snapshot save`. It ...

Comprehensive Explanation
etcd holds the entire cluster state. If etcd is lost without a backup, the cluster is irrecoverable. Backing up etcd requires using `etcdctl snapshot save`. It is critical for disaster recovery of the cluster master.
Advanced
64
Explain how Service Mesh integrates with Kubernetes.
Advanced

A service mesh (like Istio or Linkerd) is a dedicated infrastructure layer for handling service-to-service communication. It intercepts traffic (usually by inje...

Comprehensive Explanation
A service mesh (like Istio or Linkerd) is a dedicated infrastructure layer for handling service-to-service communication. It intercepts traffic (usually by injecting an Envoy proxy sidecar container into every application pod) to provide mutual TLS, traffic routing, and observability.
Advanced
65
What is a StatefulSet's VolumeClaimTemplate?
Advanced

Unlike Deployments which share exactly the same PVCs among replicas, StatefulSets feature a `volumeClaimTemplates` field. It dynamically provisions a unique PV/...

Comprehensive Explanation
Unlike Deployments which share exactly the same PVCs among replicas, StatefulSets feature a `volumeClaimTemplates` field. It dynamically provisions a unique PV/PVC for *each* Replica, guaranteeing persistent storage tied to the identity of each specific ordinal pod (e.g., db-0, db-1).
Advanced
66
What is OOMKilled and why does it happen?
Advanced

OOMKilled stands for Out Of Memory Killed. It happens when a container tries to consume more memory than its assigned `limits.memory` in the Pod spec, causing t...

Comprehensive Explanation
OOMKilled stands for Out Of Memory Killed. It happens when a container tries to consume more memory than its assigned `limits.memory` in the Pod spec, causing the kernel's OOM killer to terminate the container process (Exit Code 137).
Advanced
67
What is a LimitRange?
Advanced

A LimitRange is a policy to constrain resource allocations (to Pods or Containers) in a namespace. It is used to enforce minimum/maximum resource usage per cont...

Comprehensive Explanation
A LimitRange is a policy to constrain resource allocations (to Pods or Containers) in a namespace. It is used to enforce minimum/maximum resource usage per container, and to inject default CPU and Memory Requests and Limits for containers that don't specify them.
Advanced
68
What is a ResourceQuota?
Advanced

While LimitRange applies constraints to individual Pods/Containers, a ResourceQuota provides constraints that limit aggregate resource consumption per Namespace...

Comprehensive Explanation
While LimitRange applies constraints to individual Pods/Containers, a ResourceQuota provides constraints that limit aggregate resource consumption per Namespace. It can limit the total amount of CPUs, memory, or the number of objects (like Pods, Services, PVCs) in a namespace.
Advanced
69
How does iptables relate to kube-proxy?
Advanced

In the default `iptables` proxy mode, kube-proxy watches the control plane for Service and Endpoint objects. It then creates iptables rules on the host node to ...

Comprehensive Explanation
In the default `iptables` proxy mode, kube-proxy watches the control plane for Service and Endpoint objects. It then creates iptables rules on the host node to capture traffic directed to the Service's ClusterIP and Port and redirects it to one of the backend Pod IPs.
Advanced
70
What are Ephemeral Containers?
Advanced

Ephemeral containers are a special type of container that runs temporarily in an existing Pod to accomplish user-initiated actions such as troubleshooting or de...

Comprehensive Explanation
Ephemeral containers are a special type of container that runs temporarily in an existing Pod to accomplish user-initiated actions such as troubleshooting or debugging. They are injected using `kubectl debug`, useful when applications crash and the container lacks a shell.
Advanced
71
Explain the `ImagePullPolicy`.
Advanced

It determines when kubelet should attempt to pull the image: `Always` (pull every time, forces registry check), `IfNotPresent` (pull only if not cached locally)...

Comprehensive Explanation
It determines when kubelet should attempt to pull the image: `Always` (pull every time, forces registry check), `IfNotPresent` (pull only if not cached locally), and `Never` (never pull, fail if not locally present). `Always` is highly recommended in production to ensure patched images are used.
Advanced
72
What are EndpointSlices?
Advanced

EndpointSlices provide a more scalable and extensible alternative to Endpoints. In large clusters, a single Endpoints object containing thousands of IPs becomes...

Comprehensive Explanation
EndpointSlices provide a more scalable and extensible alternative to Endpoints. In large clusters, a single Endpoints object containing thousands of IPs becomes a bottleneck. EndpointSlices chunk these IPs into smaller, manageable chunks (default 100 per slice).
Advanced
73
How does Kubernetes handle certificates?
Advanced

Kubernetes uses PKI (Public Key Infrastructure) internally. Components authenticate to the API server using x509 certificates. The cluster has a CA (Certificate...

Comprehensive Explanation
Kubernetes uses PKI (Public Key Infrastructure) internally. Components authenticate to the API server using x509 certificates. The cluster has a CA (Certificate Authority). The kubelet uses TLS bootstrapping to generate CSRs and obtain certificates from the api-server automatically.
Advanced
74
What is Server-Side Apply?
Advanced

Server-Side Apply moves the responsibility of merging and conflict resolution of object configuration from the `kubectl` client to the Kubernetes API server its...

Comprehensive Explanation
Server-Side Apply moves the responsibility of merging and conflict resolution of object configuration from the `kubectl` client to the Kubernetes API server itself. It tracks 'field management' to know which controller/user owns specific fields.
Advanced
75
What is the Downward API?
Advanced

The Downward API allows containers to consume information about themselves or the cluster without coupling to the Kubernetes API. You can expose details like th...

Comprehensive Explanation
The Downward API allows containers to consume information about themselves or the cluster without coupling to the Kubernetes API. You can expose details like the Pod's name, namespace, labels, or CPU/Memory requests to the container via environment variables or volumes.
Advanced
76
How do you forcefully delete a Pod that is stuck in Terminating status?
Scenario

You use the `--force` and `--grace-period=0` flags.

Comprehensive Explanation
You use the `--force` and `--grace-period=0` flags.
Command / Code
kubectl delete pod <pod-name> --grace-period=0 --force
Scenario
77
How do you check the resource usage (CPU/Memory) of Pods?
Scenario

You use the `kubectl top` command (requires metrics-server to be installed).

Comprehensive Explanation
You use the `kubectl top` command (requires metrics-server to be installed).
Command / Code
kubectl top pods
Scenario
78
How do you check the logs of a specific container in a multi-container pod?
Scenario

Use `kubectl logs` and specify the container name using the `-c` flag.

Comprehensive Explanation
Use `kubectl logs` and specify the container name using the `-c` flag.
Command / Code
kubectl logs <pod-name> -c <container-name>
Scenario
79
You deployed an app, but the pods are in 'CrashLoopBackOff'. How do you troubleshoot?
Scenario

1. Check the logs (`kubectl logs pod-name`). 2. Look at previous container logs (`kubectl logs pod-name --previous`). 3. Describe the pod to see events (`kubect...

Comprehensive Explanation
1. Check the logs (`kubectl logs pod-name`). 2. Look at previous container logs (`kubectl logs pod-name --previous`). 3. Describe the pod to see events (`kubectl describe pod pod-name`).
Scenario
80
How do you quickly create a pod for testing without writing YAML?
Scenario

Use the imperative `kubectl run` command.

Comprehensive Explanation
Use the imperative `kubectl run` command.
Command / Code
kubectl run test-pod --image=nginx --restart=Never
Scenario
81
How do you execute a shell inside a running pod?
Scenario

Use `kubectl exec` with the interactive (`-it`) flags.

Comprehensive Explanation
Use `kubectl exec` with the interactive (`-it`) flags.
Command / Code
kubectl exec -it <pod-name> -- /bin/bash
Scenario
82
How do you forward a local port to a port on a pod for debugging?
Scenario

Use `kubectl port-forward` to map a local port to the pod port.

Comprehensive Explanation
Use `kubectl port-forward` to map a local port to the pod port.
Command / Code
kubectl port-forward pod/<pod-name> 8080:80
Scenario
83
How do you generate a YAML template for a deployment without actually creating it?
Scenario

Use the `--dry-run=client` and `-o yaml` flags.

Comprehensive Explanation
Use the `--dry-run=client` and `-o yaml` flags.
Command / Code
kubectl create deploy web --image=nginx --dry-run=client -o yaml > deployment.yaml
Scenario
84
How do you scale a deployment imperatively to 5 replicas?
Scenario

Use the `kubectl scale` command.

Comprehensive Explanation
Use the `kubectl scale` command.
Command / Code
kubectl scale deployment/web --replicas=5
Scenario
85
Your pod is 'Pending'. What is the most likely cause?
Scenario

A 'Pending' pod usually means the scheduler cannot find a suitable node to place the pod. Common causes are lack of CPU/Memory resources on nodes, untolerated t...

Comprehensive Explanation
A 'Pending' pod usually means the scheduler cannot find a suitable node to place the pod. Common causes are lack of CPU/Memory resources on nodes, untolerated taints, or unsatisfiable node selectors. Use `kubectl describe pod` to see the scheduler events.
Scenario
86
How do you update the image of a deployment imperatively?
Scenario

Use the `kubectl set image` command.

Comprehensive Explanation
Use the `kubectl set image` command.
Command / Code
kubectl set image deployment/web nginx=nginx:1.19
Scenario
87
How do you watch resources in real-time?
Scenario

Use the `-w` or `--watch` flag with the get command.

Comprehensive Explanation
Use the `-w` or `--watch` flag with the get command.
Command / Code
kubectl get pods -w
Scenario
88
How do you extract a secret's base64 decoded value?
Scenario

Get the secret in JSON/YAML, extract the base64 string, and pipe it to `base64 -d`. Or use go-templates directly.

Comprehensive Explanation
Get the secret in JSON/YAML, extract the base64 string, and pipe it to `base64 -d`. Or use go-templates directly.
Command / Code
kubectl get secret my-secret -o jsonpath='{.data.password}' | base64 --decode
Scenario
89
How do you drain a node for maintenance?
Scenario

Use `kubectl drain`. You may need to ignore daemonsets.

Comprehensive Explanation
Use `kubectl drain`. You may need to ignore daemonsets.
Command / Code
kubectl drain <node-name> --ignore-daemonsets --delete-emptydir-data
Scenario
90
How do you mark a node as schedulable again?
Scenario

Use the `kubectl uncordon` command.

Comprehensive Explanation
Use the `kubectl uncordon` command.
Command / Code
kubectl uncordon <node-name>
Scenario
91
How do you temporarily pause a deployment's rollout?
Scenario

Use the `kubectl rollout pause` command. Subsequent updates to the deployment will not trigger a rollout until resumed.

Comprehensive Explanation
Use the `kubectl rollout pause` command. Subsequent updates to the deployment will not trigger a rollout until resumed.
Command / Code
kubectl rollout pause deployment/web
Scenario
92
How do you query the CPU and memory requests of all pods on a specific node?
Scenario

Describe the node. The output includes an 'Allocated resources' section which lists requests and limits for the node.

Comprehensive Explanation
Describe the node. The output includes an 'Allocated resources' section which lists requests and limits for the node.
Command / Code
kubectl describe node <node-name>
Scenario
93
How do you copy a file from your local machine to a pod?
Scenario

Use the `kubectl cp` command.

Comprehensive Explanation
Use the `kubectl cp` command.
Command / Code
kubectl cp ./localfile.cfg <pod-name>:/path/in/container/
Scenario
94
A deployment fails to rollout and gets stuck. How do you check the rollout status?
Scenario

Use the `kubectl rollout status` command.

Comprehensive Explanation
Use the `kubectl rollout status` command.
Command / Code
kubectl rollout status deployment/web
Scenario
95
How do you apply a directory containing multiple YAML files?
Scenario

Use `kubectl apply` pointing to the directory.

Comprehensive Explanation
Use `kubectl apply` pointing to the directory.
Command / Code
kubectl apply -f ./my-manifests/
Scenario
96
How do you find which pod is using the most memory?
Scenario

Use `kubectl top pods` and sort by memory.

Comprehensive Explanation
Use `kubectl top pods` and sort by memory.
Command / Code
kubectl top pods --sort-by=memory
Scenario
97
How do you modify an existing resource interactively in your editor?
Scenario

Use the `kubectl edit` command. It opens the resource manifest in your default terminal editor (like vi).

Comprehensive Explanation
Use the `kubectl edit` command. It opens the resource manifest in your default terminal editor (like vi).
Command / Code
kubectl edit deployment/web
Scenario
98
You lost access to your cluster. Where can you find your Kubeconfig file?
Scenario

The standard kubelet configuration file (kubeconfig) is located at `~/.kube/config`. If you are using Cloud providers, you fetch it via their CLI (e.g., `aws ek...

Comprehensive Explanation
The standard kubelet configuration file (kubeconfig) is located at `~/.kube/config`. If you are using Cloud providers, you fetch it via their CLI (e.g., `aws eks update-kubeconfig`).
Scenario
99
How to see the history of a deployment's revisions?
Scenario

Use the `kubectl rollout history` command.

Comprehensive Explanation
Use the `kubectl rollout history` command.
Command / Code
kubectl rollout history deployment/web
Scenario
100
How do you list all pods that have a specific label, e.g., 'app=nginx'?
Scenario

Use the `-l` selector flag.

Comprehensive Explanation
Use the `-l` selector flag.
Command / Code
kubectl get pods -l app=nginx
Scenario