Mayank Singh
Kubernetes Overview:
Kubernetes, often abbreviated as K8s, is an open-source container
orchestration platform developed by Google. It automates the deployment,
scaling, and management of containerized applications. Kubernetes helps
manage clusters of nodes running containers, ensuring efficient resource
utilization, fault tolerance, and high availability of applications.
1. What is Kubernetes?
Mayank Singh
Kubernetes is a container orchestration platform used to deploy, scale, and
manage containerized applications. It groups containers into logical units called
pods, enabling easy management. Kubernetes provides features like load
balancing, self-healing, and automated rollouts/rollbacks to simplify the
deployment and management process of distributed systems.
2. What are the main components of Kubernetes architecture?
Master Node: Manages the Kubernetes cluster. Components:
o API Server
o Scheduler
o Controller Manager
o etcd (Key-Value Store)
Worker Node: Runs application workloads. Components:
o Kubelet
o Kube Proxy
o Container Runtime (e.g., Docker)
Together, these components help manage workloads and
communication between nodes.
3. What is a Pod in Kubernetes?
A pod is the smallest deployable unit in Kubernetes. It represents a single
instance of an application or a group of closely related containers that share:
Storage volumes
Networking namespace
Resources such as CPU and memory.
4. What is the role of the API Server in Kubernetes?
The API Server is the entry point for all administrative tasks. It exposes
Kubernetes APIs and acts as a gateway for the cluster, processing REST
operations. The API Server validates requests, ensures data consistency using
etcd, and communicates with other components.
5. What is etcd in Kubernetes?
Mayank Singh
etcd is a distributed key-value store used in Kubernetes for storing cluster
configuration data, including the state of all resources. It ensures consistency
and reliability, making it essential for the Kubernetes control plane.
6. What is a ReplicaSet in Kubernetes?
A ReplicaSet ensures that a specified number of pod replicas are running at all
times. If a pod fails, the ReplicaSet replaces it. It is commonly used with
deployments to maintain desired pod states and scale applications.
7. What is a Deployment in Kubernetes?
A Deployment is a higher-level abstraction in Kubernetes that manages
ReplicaSets and pods. It allows:
Declarative updates for pods and ReplicaSets.
Rollbacks to previous versions.
Scaling of applications.
8. How does Kubernetes achieve self-healing?
Kubernetes automatically restarts failed containers, replaces and reschedules
pods on healthy nodes, and kills containers that do not respond to health
checks. This ensures application reliability and availability.
9. What is a Service in Kubernetes?
A Service is an abstraction that defines a logical set of pods and a policy to
access them. It provides stable IP addresses and DNS names, enabling seamless
communication between different application components.
10. What is a Namespace in Kubernetes?
Namespaces are virtual clusters within a Kubernetes cluster. They provide a
way to divide cluster resources between multiple users or teams, enabling
isolation and better resource management.
11. How does Kubernetes handle scaling?
Kubernetes supports two types of scaling:
Horizontal Pod Autoscaling (HPA): Automatically adjusts the number of
pods based on CPU or memory usage.
Vertical Pod Autoscaling: Adjusts the resources (CPU/memory) of a pod.
Mayank Singh
12. What is a StatefulSet in Kubernetes?
StatefulSet manages stateful applications. Unlike Deployments, it ensures that
pods are created, updated, and deleted in an ordered sequence and maintain
persistent storage.
13. What is a DaemonSet in Kubernetes?
A DaemonSet ensures that all (or some) nodes in a cluster run a copy of a pod.
Common use cases include log collection, monitoring agents, or network
services.
14. How does Kubernetes perform load balancing?
Kubernetes uses Services to distribute network traffic among pods. It supports:
Internal Load Balancing: Through ClusterIP.
External Load Balancing: By integrating with cloud providers like AWS or
GCP.
15. What is kube-proxy?
kube-proxy is a network proxy running on each node. It handles network traffic
between pods and services by managing IP addresses and port forwarding.
16. What is ConfigMap in Kubernetes?
ConfigMap is used to store configuration data in key-value pairs. It separates
configuration from application code, allowing dynamic updates without
rebuilding the container image.
17. What is a Secret in Kubernetes?
A Secret is a way to store sensitive information like passwords, API keys, or
certificates securely. It ensures sensitive data is encrypted and only accessible
to authorized components.
18. What is Helm in Kubernetes?
Helm is a package manager for Kubernetes. It simplifies the deployment of
applications by managing reusable YAML configurations (Helm charts) for
Kubernetes resources.
19. What is the difference between Docker Swarm and Kubernetes?
Mayank Singh
Docker Swarm: Native clustering tool for Docker, easier to use but
limited in features.
Kubernetes: More robust and feature-rich with better scalability,
monitoring, and fault tolerance.
20. What is the use of kubectl?
kubectl is the command-line tool for interacting with Kubernetes clusters. It
allows users to manage resources, deploy applications, and retrieve logs.
What is Ingress in Kubernetes?
Ingress is an API object that manages external HTTP/S access to services in a
cluster. It provides routing rules for traffic based on URLs, domains, and other
parameters. Ingress is commonly used for exposing services to the internet.
22. What is a Node in Kubernetes?
A Node is a physical or virtual machine that serves as a worker in a Kubernetes
cluster. Each Node contains the necessary services to run pods, such as a
container runtime, kubelet, and kube-proxy.
23. What is kubelet in Kubernetes?
kubelet is an agent that runs on each node. It ensures the containers described
in a pod spec are running and communicates with the master components to
maintain the cluster state.
24. How do you secure Kubernetes clusters?
To secure a Kubernetes cluster:
Use Role-Based Access Control (RBAC) for permissions.
Enable TLS for API Server communication.
Regularly update and patch Kubernetes versions.
Use namespaces for isolation.
Mayank Singh
Configure network policies.
25. What is Kubernetes Scheduler?
The Kubernetes Scheduler assigns pods to nodes. It considers factors like
resource availability (CPU, memory), policies, and constraints to determine the
best node for each pod.
26. What is the difference between ClusterIP, NodePort, and LoadBalancer
services?
ClusterIP: Default type; makes services accessible within the cluster only.
NodePort: Exposes the service on a static port on each node's IP.
LoadBalancer: Integrates with cloud providers to create external load
balancers for services.
27. What are Persistent Volumes (PVs) and Persistent Volume Claims (PVCs)?
PV: A cluster-wide resource representing storage that can be
provisioned.
PVC: A request for storage by a pod, which binds to a PV to claim
storage.
These abstractions help decouple storage from pod lifecycles.
28. What is a Kubernetes ConfigMap vs. Secret?
ConfigMap: Stores non-sensitive configuration data in key-value pairs.
Secret: Stores sensitive information (encrypted), such as credentials or
API keys.
Both are mounted as files or environment variables into pods.
29. How does Kubernetes handle resource limits?
Kubernetes uses requests and limits to manage resources:
Mayank Singh
Requests: Minimum guaranteed CPU/memory a pod requires.
Limits: Maximum CPU/memory a pod can use.
These ensure fair resource allocation and prevent over-utilization.
30. What is the Kubernetes control plane?
The control plane manages the cluster's state and workload. It consists of
components like the API Server, etcd, Scheduler, and Controller Manager. These
components interact to ensure proper cluster operation.
31. How are updates and rollbacks managed in Kubernetes?
Kubernetes handles updates using Deployments.
Rollouts: Deploy updated versions of applications incrementally.
Rollbacks: Revert to a previous version if issues occur, ensuring minimal
downtime.
32. What is a Kubernetes Job?
A Job ensures that a specified number of tasks (pods) are completed
successfully. It is used for batch or short-lived tasks like data processing.
33. What is a CronJob in Kubernetes?
A CronJob is a type of job that runs tasks periodically based on a schedule (like
a cron expression). It is ideal for running automated maintenance or cleanup
tasks.
34. What is the difference between PodAffinity and NodeAffinity?
PodAffinity: Specifies that certain pods should run on the same node or
close to other pods for better performance or communication.
NodeAffinity: Determines specific nodes on which pods should run
based on node labels.
Mayank Singh
35. What is the Horizontal Pod Autoscaler (HPA)?
HPA automatically scales the number of pods based on metrics like CPU or
memory usage. It helps optimize resource utilization by dynamically adjusting
workloads.
36. What is Taint and Toleration in Kubernetes?
Taint: Applied to nodes to prevent pods from being scheduled on them.
Toleration: Allows specific pods to run on nodes with matching taints,
providing flexibility in scheduling.
37. How does Kubernetes handle storage?
Kubernetes uses StorageClasses to dynamically provision storage. Persistent
Volumes (PVs) and Persistent Volume Claims (PVCs) decouple storage from
pods, allowing data persistence even when pods are deleted.
38. What are Init Containers in Kubernetes?
Init containers run before the main container in a pod. They are used for setup
tasks like loading configuration files or waiting for dependencies to initialize.
39. How do Kubernetes Network Policies work?
Network Policies define rules for how pods communicate with each other and
external systems. They use labels and selectors to allow or block traffic based
on criteria like IP addresses and ports.
40. What is a Kubernetes Federation?
Federation allows multiple Kubernetes clusters to be managed as a single
entity. It provides features like multi-cluster resource deployment and failover
across clusters.
Mayank Singh
41. What is the role of the Kubernetes Controller Manager?
The Controller Manager is a core control plane component that manages
controllers like:
Node Controller
Deployment Controller
ReplicaSet Controller
It ensures the desired state of resources matches the current state.
42. What is the role of the Kubernetes Scheduler?
The Scheduler assigns pods to nodes based on resource requirements,
constraints, and policies. It ensures efficient utilization of cluster resources.
43. What is kubeadm in Kubernetes?
kubeadm is a tool to initialize and configure Kubernetes clusters quickly. It
simplifies tasks like creating certificates, setting up control plane components,
and joining nodes to clusters.
44. What is the role of a CNI in Kubernetes?
CNI (Container Network Interface) provides networking capabilities for
Kubernetes. Plugins like Calico, Flannel, and WeaveNet handle tasks like IP
address allocation and routing.
45. What is a Kubernetes Operator?
An Operator extends Kubernetes functionality by automating the management
of complex applications. Operators encapsulate domain knowledge to manage
application lifecycles.
46. What is a Headless Service in Kubernetes?
Mayank Singh
A Headless Service does not provide load balancing or a ClusterIP. Instead, it
allows direct access to individual pod IPs, enabling finer control over routing.
47. What is the difference between StatefulSet and Deployment?
StatefulSet: Manages stateful applications and maintains pod identity
(name, storage).
Deployment: Manages stateless applications and focuses on pod scaling
and updates.
48. How do you troubleshoot a failed pod in Kubernetes?
Steps to troubleshoot:
1. Check pod status using kubectl get pods.
2. Review pod events using kubectl describe pod <pod-name>.
3. Inspect container logs using kubectl logs <pod-name>.
4. Examine node and cluster health.
49. What is the purpose of Kubernetes RBAC?
RBAC (Role-Based Access Control) manages user permissions in Kubernetes. It
defines roles and role bindings to grant specific actions (e.g., read, write) on
resources.
50. What are Kubernetes Labels and Selectors?
Labels: Key-value pairs attached to objects like pods or services.
Selectors: Query objects based on labels to group or filter resources for
management or routing.