Kubernetes - Interview Questions

What is Kubernetes?

 Key Concept

Kubernetes, also known as K8s, is an open-source container orchestration and management platform.

Kubernetes groups containers into pods, which are the basic operational units of Kubernetes. Kubernetes scales, manages, and orchestrates these pods across a cluster of virtual machines, or nodes.

Kubernetes has in-built capabilities to automatically manage load balancing, scaling, service discovery, resource allocation, health checks, and self-healing of containers.

What are the key features provided by Kubernetes?

 Key Concept

Following are some key features provided by Kubernetes.

Service Discovery and Load Balancing - Kubernetes assigns unique IP addresses for each pod, and a unique DNS name for a set of pods. Kubernetes automatically load balances across these pods.

Self-healing - Kubernetes automatically restarts containers when they fail, replaces containers when a node goes down, and brings down containers when health check fails. Kubernetes does not expose a container to client requests, until it is ready to serve.

Auto scaling - Kubernetes automatically scales an application up or down based on CPU usage. You can also manually scale up or down by using command line interface or UI.

Configuration management - Kubernetes has the capability to deploy and update application configurations, without the need to rebuild your application.

Automated roll outs and rollbacks - Kubernetes progressively rolls out application changes, while monitoring application health checks. If the health checks fail Kubernetes will automatically rollback the changes. This ensures that all instances of the application do not come down at the same time.

Storage binding Kubernetes has the capability to automatically mount the storage system define by you - local storage, storage provided by cloud providers, or network storage systems such as NFS.

What are the key components in a Kubernetes system?

 Key Concept

Kubernetes components can be grouped into Control plane components and Node components.

Control plane components make global decisions on the cluster, and detecting and responding to cluster events.

Node components run on every node and provides Kubernetes runtime environment.

Control plane components

kube-apiserver - kube-apiserver exposes the Kubernetes APIs to other Kubernetes components

kube-controller-manager - kube-controller-manager manages and runs controller processes. There are different kinds of controllers such as - Node controllers which track and respond when nodes go down, job controller which creates pods to run one-off tasks, Endpoint controller which joins services and pods, etc.

cloud-controller-manager - cloud-controller-manager links the Kubernetes cluster to the cloud providers APIs. cloud-controller-manager manages and runs controllers specific to the cloud provider. Example of these controllers are Node controllers which manage nodes on the cloud, Route controller which sets up routes in the cloud infrastructure, Service controller which creates, updates, and deletes load balancers provided by the cloud provider.

kube-scheduler - Kube-scheduler tracks newly created pods with no assigned node, and assigns a node for the pod to run on.

etcd - etcd is a highly-available key-value store which Kubernetes uses as a backing store for all cluster data.

Node components

kubelet - kubelet is an agent that runs on every Kubernetes pod and ensures that containers are running and healthy in the pod.

kube-proxy - kube-proxy is network proxy that runs on each node in a Kubernetes cluster, which maintains network rules on nodes which allow network communication to the pods from either inside or outside of the cluster.

Container runtime - Container runtime is the software that runs containers. Container runtimes are specific to the container used such as Docker, containerd, etc.

What are Kubernetes objects?

 Key Concept

Kubernetes objects are persistent entities in the Kubernetes system which you create to represent the 'desired state' of the cluster.

Once an object is created, Kubernetes control plane actively and continually manages the object's actual state to match its desired state.

Kubernetes objects are created, updated, or deleted by using Kubernetes API - either directly by calling the RESTful APIs or indirectly via kubectl command-line interface.

If you are directly using the Kubernetes APIS, the object spec must be provided in JSON format. If you are using kubectl command-line interface the object spec is typically provided in .yaml format. kubectl internally converts the .yaml format to JSON format before calling the Kubernetes APIs.

What are some examples of Kubernetes objects?

 Key Concept

Following are some examples of Kubernetes objects.

Pod - Represents the configuration of a pod. Pod contains a collection of containers that run on a node.

ReplicaSet - Represents the configuration of a ReplicaSet. ReplicaSet Ensures that a defined number of pod instances are running at any given time.

Deployment - Represents the configuration of a Deployment. Deployment enables declarative updates for pods and ReplicaSets.

Job - Represents the configuration of a Job.

Service - Represents the configuration of Service. Configuration includes port and IP definitions, which determine which pods the requests will be routed to.

Ingress - Represents the configuration of Ingress. Ingress contains a collection of rules which allow inbound requests to reach backend endpoints.

ConfigMap - Represents the configuration of a ConfigMap. ConfigMap holds configuration data that pods consume.

Volume - Represents the configuration of Volume. Volume represents a named volume in a pod that can be accessed by any container in the pod.

 
Subscribe to our Questions

 

DevOps - Interview Questions

DevOps BasicsGITJenkinsJFrogDockerDocker SwarmKubernetes
 
RECOMMENDED RESOURCES
Behaviorial Interview
Top resource to prepare for behaviorial and situational interview questions.

STAR Interview Example