Kubernetes Top Most Asked Interview Questions 2021

Presently Kubernetes is an open-sourced and widely used containers orchestration tool. Kubernetes help to managing containerised workloads and services, that facilitates both declarative configuration and automation.

This article provides you Kubernetes top most asked interview questions and answers in 2021. We assured you, it will definitely helps you to clear your Kubernetes interviews with easiest way.

So, let’s start it.

Table of Contents

Basic

Q.1 Can you tell us, what is Kubernetes exactly?

Ans- Kubernetes is container orchestration tool or a platform. It used to manage services and containerised workloads in various types of environments such as physical, virtual and cloud environments. Kubernetes developed by Google and It is highly flexible container tool to deliver even complex applications, consistently. Applications run on clusters of hundreds to thousands of individual servers.

Q.2 What is Container Orchestration?

Ans- In simple words container orchestration is all about managing the lifecycles of containers, specially in large and dynamic environments. In software development process container orchestration tool used to control and automate many tasks such as:

  • Provisioning and deployment of containers
  • Redundancy and availability of containers
  • Scaling up and down and removing containers to spread application load even across host
  • Allocation of resources between containers
  • Exposure of services running in a container with the outside world
  • Load balancing of various service between containers
  • Health monitoring of containers and hosts
  • Configuration of an application

Q.3 Why we need Container Orchestration?

Ans- container orchestration is required to manage containers and services if we have large number of running containers with various applications and services running on it.

Q.4 Can you tell us the components of Kubernetes?

Ans- There are mainly three components in Kubernetes cluster and thats are;

  • Master components
  • Node components
  • Addons

Master components: Master have below components:

  • etcd: It is a highly available distributed key value store, which is used to store cluster wide secrets. It is only accessible by Kubernetes API server, as it has sensitive information.
  • API Server: It exposes the Kubernetes API. The Kubernetes API is the front-end for Kubernetes Control Plane, and is used to deploy and execute all operations in Kubernetes
  • Scheduler: The scheduler takes care of scheduling of all the processes, Dynamic Resource Management and manages present and future events on the cluster
  • Controller Manager: The controller manager, runs all the controllers on the Kubernetes Cluster, each controller is a separate process, but to reduce complexity, all the controllers are compiled into a single process. They are as follows: Node Controller, Replication Controller, Endpoints Controller, Service Accounts and Token Controllers

Node components: Node have below components:

  • Kubelet: Kubelet takes the specification from the API server, and ensures the application is running according to the specifications which were mentioned. Each node has it’s kubelet service
  • Kube-Proxy: This proxy service runs on each node and helps in making services available to the external host. It helps in connection forwarding to the correct resources, it is also capable of doing primitive load balancing.

Q.5 Tell us about Kubernetes cluster?

Ans- Master and node machines run in Kubernetes cluster. container cluster is the foundation of Container engine. Kubernetes that represent containerised applications all run on top of this cluster.

Q.6 Do you know what is Namespace in Kubernetes?

Ans- In Kubernetes, Namespaces are intended for use in environments with many users spread across multiple teams, or projects. Namespaces are a way to divide cluster resources between multiple uses (via resource quota). In future versions of Kubernetes, objects in the same namespace will have the same access control policies by default.

Q.7 What is the Node?

Ans- A node is a worker machine. It also known as minion previously. Now, node could be a virtual or physical machines, depending on the cluster. Each node has the services necessary to run pods and is managed by the master components. The services on a node include Docker, kubelet and kube-proxy.

Q.8 Tell us about Heapster?

Ans- Heapster is a cluster wide aggregator of monitoring and event data. Heapster, supports Kubernetes natively and works on all Kubernetes setups, including Deis Workflow setup.

Q.9 What is POD in Kubernetes?

Ans- POD is a collection of containers that share some resources, they have a single IP, and can share volumes.

Q.10 Do you know what is Kubelet?

Ans- The kubelet is nothing but it is “node agent” that runs on each node. It can register the node with the API-Server using one of the hostname a flag to override the hostname or specific logic for a cloud provider.

Q.11 Tell us, What is Minikube?

Ans- Minikube is a tool which we can use it to run Kubernetes on local machines. Minikube runs a single-node Kubernetes cluster on a virtual machine and on your local machines.

Q.12 What is the function of kube-scheduler?

Ans- Kube-scheduler assigns nodes to newly created pods and it is a default scheduler for Kubernetes.

Q.13 What is Daemon sets?

Ans- It is set of pods that runs on a host. They are used for host layers attributes like monitoring network or simple network.

Q.14 Can you tell us, Why should we use Kubernetes?

Ans- Kubernetes is the best container orchestration tool available now and it helps to solve real problems in SDLF process such as;

  • Kubernetes can run on-premises bare metal, OpenStack, public clouds Google, Azure, AWS.
  • It helps you to avoid vendor lock issues as it could use any vendor specific APIs or services except where Kubernetes provides an abstraction, e.g. load balancer and storage.
  • It will enable applications that need to be released and updated without any downtime.
  • Kubernetes allows to assure those containerised apps run where and when you want and help you to find resources and tools which you want to work.

Q.15 What are the services available in Kubernetes?

Ans- In Kubernetes below services are available,

  • Cluster IP service
  • Load Balancer service
  • Node Port service
  • External Name Creation service.

Q.16 What is Cluster IP?

Ans- Cluster IP is a Kubernetes service which provides a service inside the cluster that other apps inside cluster can access.

Q.17 What is Kube Proxy?

Ans- The Kube proxy is an implementation of both a network proxy and a load balancer. It is used to support service abstraction used with other networking operations. It is responsible for directing traffic to the container depend on IP and the port number

Q.18 What is GKE?

Ans- GKE is Google Container Engine. It is a management platform that supports clusters and Docker containers that run within public cloud services of Google.

Q.19 Do you have any idea, what are the tools available for container monitoring?

Ans- We have few tools and that are:

  • Heapster
  • cAdvisor
  • Prometheus
  • InfluxDB
  • Grafana

Q.20 Tell us about headless service?

Ans- Headless service is defined as a service that uses IP address, but instead of load balancing, it returns of associated pods.

Q.21 What are the available container orchestration tools?

Ans- There are three famous tools:

  • Docker swarm
  • Apache Mesos
  • Kubernetes.

Advanced

Q.1 What is Ingress in Kubernetes?

Ans- In simple terms we can say, ingress exposes HTTP and HTTPS routes from outside the cluster to services within the cluster. Traffic routing is controlled by rules defined on the Ingress resource.

Check the below example, where an ingress sends all its traffic to one Service

An Ingress may be configured to give Services externally-reachable URLs, load balance traffic, terminate SSL / TLS, and offer name-based virtual hosting. An Ingress controller is responsible for fulfilling the Ingress, usually with a load balancer, though it may also configure your edge router or additional frontends to help handle the traffic.

An Ingress does not expose arbitrary ports or protocols. Exposing services other than HTTP and HTTPS to the internet typically uses a service of type Service.Type=NodePort or Service.Type=LoadBalancer

Q.2 What is controller manager in Kubernetes?

Ans- In Kubernetes controller manager is a daemon used for garbage collection, core control loops, and namespace creation. It enables the running of more than one process on the master node

Q.3 What are types of Control Manager?

Ans- Kubernetes control manager’s types are;

  • Endpoints controller
  • Service accounts controller
  • Node controller
  • Namespace controller
  • Replication controller
  • Token controller.

Q.4 Can you explain us Kubernetes architecture?

Ans- Try to understand Kubernetes architecture with below image,

  • Master Node: The master node is the first and most vital component which is responsible for the management of Kubernetes cluster. It is the entry point for all kinds of administrative tasks. There may be more than one master node in the cluster to check for fault tolerance.
  • API Server: The API server acts as an entry point for all the REST commands used for controlling the cluster.
  • Scheduler: The scheduler schedules the tasks to the slave node. It stores the resource usage information for every slave node. It is responsible for distributing the workload.
  • Etcd: etcd components, store configuration detail, and wright values. It communicates with the most component to receive commands and work. It also manages network rules and port forwarding activity.
  • Worker/Slave nodes: Worker nodes are another essential component that contains all the required services to manage the networking between the containers, communicate with the master node, which allows you to assign resources to the scheduled containers.
  • Kubelet: It gets the configuration of a Pod from the API server and ensures that the described containers are up and running.
  • Docker Container: Docker container runs on each of the worker nodes, which runs the configured pods.
  • Pods: A pod is a combination of single or multiple containers that logically run together on nodes.

Q.5 Can you tell us difference in between Kubernetes and Docker Swarm?

Ans- Here is the main difference between Kubernetes & Docker Swarm:

Kubernetes Docker-Swarm
Kubernetes Provides an auto-scaling feature.Docker Swarm does not provide an auto-scaling feature.
Complicated, time consuming installation Installation is easy & fast
Manually configure load balancing  Docker-Swarm provides auto load balancing
GUI is availableGUI is not available
Provides a builtin load balancing technique.Process scheduling is done to maintain services while updating.

Q.6 What is Ingress Network?

Ans- Ingress network is a collection of rules which allow permission for connections into the Kubernetes cluster.

Q.7 What do you think, Why we required load balancer?

Ans- Load balancer is needed because it gives a standard way to distribute network traffic among different services, which runs in the backend.

Q.8 Do you have any idea on how to run Kubernetes locally?

Ans- We can run Kubernetes locally using Minikube tool. It runs a single node cluster in a virtual machine on the computer. Running Kubernetes locally offers the ideal way for users who have just started learning Kubernetes

Q.9 Tell us about important components of node status?

Ans- Important components of node status are:

  • Condition
  • Capacity
  • Info
  • Address

Q.10 What is Prometheus in Kubernetes?

Ans- Prometheus is an application which is used for monitoring and alerting. It can be called out to your systems, grab real-time metrics, compress it, and stores in a database.

Q.11 What are the objects that are used in Kubernetes?

Ans-Objects that are used in Kubernetes:

  • Pods
  • Replication sets and controllers
  • Jobs and cron jobs
  • Daemon sets
  • Distinctive identities
  • Deployments
  • Stateful sets.

Q.12 What is Stateful sets in Kubernetes?

Ans- Stateful set is a workload API object that is used to manage the stateful application. It can also be used to manage the deployments and scaling the sets of pods. The state information and other data of stateful pods are store in the disk storage, which connects with stateful set.

Q.13 Can you explain what is Replica set?

Ans- Replica set is used to keep replica pods stable. It enables us to specify the available number of identical pods. This can be considered a replacement for the replication controller

Q.14 What is the use of Kube-API-Server?

Ans- Kube API server is an API server of Kubernetes that is used to configure and validate API objects, which include services, controllers, etc. It provides the frontend to the cluster’s shared region using which components interact with each other

Q.15 Can you tell us the types of Kubernetes pods?

Ans- Types of pods in Kubernetes are:

  • Single Container Pod: It can be created with the run command.
  • Multi Container Pods: It can be created using the “create” command in Kubernetes.

Q.16 Do you know, the Secrets in Kubernetes?

Ans- Secrets are sensitive information like login credentials of the user. They are objects in Kubernetes that stores sensitive information like username and password after performing encryption

Q.17 What are the federated clusters?

Ans- Federated clusters multiple clusters that are managed as a single cluster.

Q.18 What is PVC?

Ans- PVC stands for Persistent Volume Claim. It is storage requested by Kubernetes for pods. The user does not require to know the underlying provisioning. This claim should be created in the same namespace where the pod is created

Q.19 Tell us about Kubernetes Network Policy?

Ans- Network Policy defines how the pods in the same namespace would communicate with each other and the network endpoint.

Q. 20 Explain about Kubernetes proxy service?

Ans- Kubernetes proxy service is a service which runs on the node and helps in making it available to an external host.

Q.21 Tell us about types of Kubernetes Volume?

Ans- Kubernetes volumes are:

  • EmptyDir
  • GCE persistent disk
  • Flocker
  • HostPath
  • NFS
  • ISCSI
  • rbd
  • PersistentVolumeClaim
  • downwardAPI

Q.22 Do you knows the ways to provide API Security on Kubernetes?

Ans The ways to provide API-Security on Kubernetes:

  • Using correct auth mode with API server authentication mode= Node
  • Make kubeless that protects its API via authorization-mode=Webhook.
  • Ensure the kube-dashboard uses a restrictive RBAC (Role-Based Access Control) policy

Q.23 Tell us the difference between Docker volumes and Kubernetes Volumes?

Ans- Docker volumes and Kubernetes Volumes difference are:

Docker VolumesKubernetes Volumes
Volumes are limited to a pod in the containerVolumes are not limited to any container
Docker volumes do not support all containers deployed in Docker.Kubernetes volumes support all containers deployed in a pod of Kubernetes

Conclusion:

This way we have covered Kubernetes top and mostly asked interview questions and answers for fresher and experienced candidate.

Reference:

Kubernetes official documents.

Related Articles:

Jenkins mostly asked real interview questions & answers

Docker mostly asked real interview questions & answers

DevOps Article

DevOps Article. Your Learnings Hub.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.