What is Kubernetes?
Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications.
What is a Pod in Kubernetes?
A Pod is the smallest deployable unit in Kubernetes, consisting of one or more containers that share resources such as networking and storage.
What is a Deployment in Kubernetes?
A Deployment in Kubernetes is an object that manages a set of identical Pods, ensuring that a specified number of them are running at any given time.
Explain the role of a Service in Kubernetes.
A Service in Kubernetes provides a consistent way to access and communicate with a group of Pods, abstracting away the details of individual Pod IP and managing load balancing across them.
What is the purpose of a ReplicaSet?
A ReplicaSet ensures that a specified number of identical Pods are running at any given time, replacing any Pods that fail or are terminated.
What is a Namespace in Kubernetes?
A Namespace is a virtual cluster within a Kubernetes cluster that provides a scope for names. It is used to organize and divide cluster resources between multiple users or teams.
How do you scale an application in Kubernetes?
You can scale an application in Kubernetes by adjusting the number of replicas in its Deployment or ReplicaSet object using the kubectl scale command or by updating the object's YAML configuration file.
What is a Label in Kubernetes, and why is it important?
A Label in Kubernetes is a key-value pair attached to objects such as Pods, Services, and Deployments, used for identification, grouping, and selecting objects for various purposes such as querying, monitoring, and managing.
Explain the concept of a ServiceAccount in Kubernetes.
A ServiceAccount in Kubernetes is an identity associated with a Pod that grants it permissions to interact with the Kubernetes API and access other cluster resources.
What is a Secret in Kubernetes, and why is it used?
A Secret in Kubernetes is an object used to store sensitive information such as passwords, API keys, and certificates, encrypted at rest, and mounted into Pods as files or environment variables.
How do you expose a Pod to the outside world in Kubernetes?
You can expose a Pod to the outside world in Kubernetes by creating a Service object of type Loadbalancer or NodePort which assigns an external IP address or port to the Pod respectively.
What is the difference between a Stateful application and a Stateless application in Kubernetes?
A Stateful application maintains state or data across Pod restarts or rescheduling, while a Stateless application does not require persistent state and can be easily replaced or scaled out without affecting its functionality.
How do you specify the number of replicas for a Deployment?
You can specify the number of replicas for a Deployment in Kubernetes by setting the replicas field in the Deployment's YAML configuration file or by using the command.
kubectl scale --replicas=3 rs/foo
Explain the concept of a PersistentVolumeClaim (PVC) in Kubernetes.
A PersistentVolumeClaim (PVC) in Kubernetes is a request for storage resources from a PersistentVolume (PV), allowing Pods to access persistent storage independent of the underlying storage implementation.
what are pv and pvc?
PVs are the storage resources provided by the cluster, while PVCs are the requests made by Pods to use those resources. PVs are provisioned and managed by administrators, while PVCs are created and managed by users or applications.
How does Kubernetes handle application upgrades/downgrades?
Kubernetes handles application upgrades/downgrades by rolling out changes incrementally, ensuring zero-downtime deployments by replacing old Pods with new ones gradually and verifying their health before proceeding with the next batch.
Explain kubernetes architecture?
The architecture of Kubernetes is designed to provide a scalable and highly available platform for managing containerized applications. At a high level, Kubernetes follows a master-slave architecture, with a set of control plane components running on the master node and worker nodes (also called minions) running the application workloads.
Control Plane Components (Master Node):
API Server:
The API server is the central management component of Kubernetes. It exposes the Kubernetes API, which is used by users, administrators, and controllers to interact with the cluster.
Scheduler:
The Scheduler is responsible for scheduling Pods onto available worker nodes based on resource requirements, quality of service, and other constraints specified in Pod specifications.
Controller Manager:
The Controller Manager manages various controllers that regulate the state of the cluster. These controllers include the Replication Controller, ReplicaSet Controller, Endpoint Controller, and Service Account & Token Controller.
etcd:
Etcd is a distributed key-value store that is used as the primary datastore for Kubernetes. It is a critical component in a Kubernetes cluster, responsible for storing the cluster's configuration data.
Node Components (Worker Nodes):
Kubelet:
Kubelet is an agent that runs on each node and is responsible for managing the Pods and their containers. It interacts with the API server to receive Pod specifications and ensures that the containers in those Pods are running and healthy.
Kube-proxy:
Kube-proxy is a network proxy that runs on each node. It maintains network rules on nodes, allowing communication to Pods from other Pods within the cluster and from outside the cluster.
Container Runtime:
The container runtime (e.g., Docker, containerd, or CRI-O) is responsible for running containers within Pods. It pulls container images from registries, creates container instances, and manages their lifecycle.
Communication Flow:
Users interact with the Kubernetes cluster through the API server, which authenticates and authorizes requests.
The Scheduler assigns Pods to nodes based on resource availability and other constraints.
Kubelet on each node communicates with the API server to retrieve Pod specifications and manages the containers on that node accordingly.
Kube-proxy maintains network rules and enables communication between Pods and Services within the cluster and from outside the cluster.
What are the main components of Kubernetes?
we can divide the components into two.
Control plane (Api server, schedular,Controller Manager,Etcd)
Data plane (Kubelete, kube-proxy, container runtime)
What is Kubectl?
Kubectl is the command line configuration tool to communicate with the Kubernetes cluster.
What is Kubeadm?
Kubeadm is a tool used for bootstrapping Kubernetes clusters. Joining control-plane nodes and worker nodes to the cluster.