Kubernetes Interview Questions


Q) Kubernetes Components:
The control plane is the system that maintains a record of all Kubernetes objects. 
1. Master Components:
Ø kube-apiserver: It acts as front-end for Kubernetes control plane. It exposes the Kubernetes API. CLItools (like kubectl), Users and even Master components (scheduler, control manager, etcd) and worker node components (like kubelet) everything talks with API server.
Øetcd: Consistent and highly available key-value store used as Kubernetes backing store for all cluster data. It stores all master and worker node information.
Økube-scheduler: Scheduler is responsible for distributing containers across multiple nodes. It watches for the newly created pod with no assigned node and select a node for them to run on.
Økube-control-manager: Controllers are responsible for noticing and responding when nodes, containers, or endpoints go down.        They make decisions to bring up new containers in such cases.
Node controller: Responsible for noticing and responding when nodes go down.
Replication controller: Responsible for maintaining the correct number of pods for every replication controller object in the system.
Endpoints controller: Populates the Endpoints object (that is, joins Services & Pods).
Service Account & Token controllers: Create default accounts and API access tokens for new namespaces.
2. Worker Components:
Ø  kubete: It is the Agent that runs on each node in the cluster. This agent is responsible for making sure that containers are running in a pod on a node.
Ø  kube-proxy: It is a network proxy that runs on each node in your cluster. It maintains network rules on nodes. Handles network communication between nodes by adding firewall routing rules.
Container Runtime: The container runtime is the software that is responsible for running containers. Kubernetes supports several container runtimes: Docker, containerd, CRI-O

Q) Kubernetes Node Type:
Kube Cluster is made up of two types of nodes:
Kube Masters: These servers are responsible for managing the Kube cluster as a whole. It has all the master components installed on it. They are also referred to as the controller node.  
Kube Workers:
These servers are responsible for running the actual pods, that the Kube Master instructs them to run. They have all the worker components installed on them. 

Q) Kubernetes Service and its Type?
A Service enables network access to a set of Pods in Kubernetes.
The type property in the Service's spec determines how the service is exposed to the network. The possibles types are ClusterIP, NodePort, LoadBalancer, and ExternalName
Ø  ClusterIp: The default value. The service is only accessible from within the Kubernetes cluster
Ø  NodePort: This makes the service accessible on a static port on each Node in the cluster.
Ø  LoadBalancer: The service becomes accessible externally through a cloud provider's load balancer functionality. GCP, AWS, Azure, and OpenStack offer this functionality.
Ø  ExternalName: Exposes the Service using an arbitrary name by returning a CNAME record with the name.