Kubernetes Interview Questions and Answers
Interview Kubernetes engine
Top 25 Kubernetes Interview Questions You Must Prepare In 2019 & 2020
Q1 :- What is Kubernetes?
Kubernetes is an open-source container management tool which holds the responsibilities of container deployment, scaling & descaling of containers & load balancing. Being the Google’s brainchild, it offers excellent community and works brilliantly with all the cloud providers. So, we can say that Kubernetes is not a containerization platform, but it is a multi-container management solution.
Q2. What is the relation between Docker and Kubernetes?
Answer: This is one of the most common questions asked in a Kubernetes interview. You can find this question commonly in all the lists of Kubernetes interview questions. The candidate should answer this question as Docker is a platform used for lifecycle management of containers with a Docker image, responsible for building runtime containers. However, Kubernetes is the solution for communication between the individual containers. Therefore, Kubernetes helps in manual linking and orchestration of containers running on multiple hosts created using Docker. Let us move towards the next entry in Kubernetes interview questions
Q3. What is the difference between Kubernetes and Docker Swarm?
Answer: The third entry is also one of the top Kubernetes interview questions. The answer to this Kubernetes interview question would be a little detailed with a focus on different points. The difference points include installation and cluster configuration, GUI, auto-scaling, data volume, scalability, load balancing, logging and monitoring, and rolling updates and rollbacks. Here are the main points of difference between Kubernetes and Docker Swarm.
- Kubernetes has a complicated setup with the assurance of a robust cluster while Docker Swarm is easier to set up but without a robust cluster.
- The scalability of Docker Swarm is five times faster than Kubernetes. Kubernetes provides a dashboard as GUI while Docker Swarm does not have any GUI.
- Kubernetes is capable of auto-scaling while Docker Swarm cannot. However, Kubernetes needs manual intervention for load balancing of traffic as compared to the automatic load balancing in Docker Swarm.
- Kubernetes has integrated tools for logging and monitoring, unlike Docker Swarm, which needs third party tools for the same.
- Kubernetes is limited in term of data volumes as it can share storage with other containers in the same pod while Docker swarm could share storage volumes with other containers easily.
- The final point is the ability of Kubernetes to deploy rolling updates and automatic rollbacks. On the other hand, Docker Swarm could deploy rolling updates but does not have the ability for automatic rollbacks.
Q4. How is Kubernetes related to Docker?
It’s a known fact that Docker provides the lifecycle management of containers and a Docker image builds the runtime containers. But, since these individual containers have to communicate, Kubernetes is used. So, Docker builds the containers and these containers communicate with each other via Kubernetes. So, containers running on multiple hosts can be manually linked and orchestrated using Kubernetes.
Q5. What is Container Orchestration?
Consider a scenario where you have 5-6 microservices for an application. Now, these microservices are put in individual containers, but won’t be able to communicate without container orchestration. So, as orchestration means the amalgamation of all instruments playing together in harmony in music, similarly container orchestration means all the services in individual containers working together to fulfill the needs of a single server.
Q6. How does Kubernetes simplify containerized Deployment?
As a typical application would have a cluster of containers running across multiple hosts, all these containers would need to talk to each other. So, to do this you need something big that would load balance, scale & monitor the containers. Since Kubernetes is cloud-agnostic and can run on any public/private providers it must be your choice simplify containerized deployment.
Q7. What is Google Container Engine?
Google Container Engine (GKE) is an open source management platform for Docker containers and the clusters. This Kubernetes based engine supports only those clusters which run within the Google’s public cloud services.
Q8. What is Heapster?
Heapster is a cluster-wide aggregator of data provided by Kubelet running on each node. This container management tool is supported natively on Kubernetes cluster and runs as a pod, just like any other pod in the cluster. So, it basically discovers all nodes in the cluster and queries usage information from the Kubernetes nodes in the cluster, via on-machine Kubernetes agent.
Q9. What is Minikube?
Minikube is a tool that makes it easy to run Kubernetes locally. This runs a single-node Kubernetes cluster inside a virtual machine.
Q10. What is Kubectl?
Kubectl is the platform using which you can pass commands to the cluster. So, it basically provides the CLI to run commands against the Kubernetes cluster with various ways to create and manage the Kubernetes component.
Q11. What is Kubelet?
This is an agent service which runs on each node and enables the slave to communicate with the master. So, Kubelet works on the description of containers provided to it in the PodSpec and makes sure that the containers described in the PodSpec are healthy and running.
Q12. What do you understand by Kube-proxy?
Kube-proxy can run on each and every node and can do simple TCP/UDP packet forwarding across backend network service. So basically, it is a network proxy which reflects the services as configured in Kubernetes API on each node. So, the Docker-linkable compatible environment variables provide the cluster IPs and ports which are opened by proxy.
Q13. What is the role of kube-apiserver and kube-scheduler?
The kube – apiserver follows the scale-out architecture and, is the front-end of the master node control panel. This exposes all the APIs of the Kubernetes Master node components and is responsible for establishing communication between Kubernetes Node and the Kubernetes master components.
The kube-scheduler is responsible for distribution and management of workload on the worker nodes. So, it selects the most suitable node to run the unscheduled pod based on resource requirement and keeps a track of resource utilization. It makes sure that the workload is not scheduled on nodes which are already full.
Q14. What is ETCD?
Etcd is written in Go programming language and is a distributed key-value store used for coordinating between distributed work. So, Etcd stores the configuration data of the Kubernetes cluster, representing the state of the cluster at any given point in time.
Q15. What do you understand by load balancer in Kubernetes?
A load balancer is one of the most common and standard ways of exposing service. There are two types of load balancer used based on the working environment i.e. either the Internal Load Balancer or the External Load Balancer. The Internal Load Balancer automatically balances load and allocates the pods with the required configuration whereas the External Load Balancer directs the traffic from the external load to the backend pods.
Q16. What is the difference between a replica set and replication controller?
Replica Set and Replication Controller do almost the same thing. Both of them ensure that a specified number of pod replicas are running at any given time. The difference comes with the usage of selectors to replicate pods. Replica Set use Set-Based selectors while replication controllers use Equity-Based selectors.
Equity-Based Selectors: This type of selector allows filtering by label key and values. So, in layman terms, the equity-based selector will only look for the pods which will have the exact same phrase as that of the label.
Example: Suppose your label key says app=nginx, then, with this selector, you can only look for those pods with label app equal to nginx.
Selector-Based Selectors: This type of selector allows filtering keys according to a set of values. So, in other words, the selector based selector will look for pods whose label has been mentioned in the set.
Example: Say your label key says app in (nginx, NPS, Apache). Then, with this selector, if your app is equal to any of nginx, NPS, or Apache, then the selector will take it as a true result.
Q17. How does the master node work in Kubernetes?
Answer: The answer to the question would be that the master node controls the nodes having the containers. The containers are placed inside pods, and each pod may have different containers. The pods can be deployed through the command line interface or user interface. Following that, the pods are scheduled on the nodes, and then pods are allocated to the nodes based on resource requirements.
Q18. What is the Kubernetes controller manager?
Answer: Another latest Kubernetes interview question is on the Kubernetes controller manager. The controller manager works as a daemon that is used for embedding controllers and garbage collection as well as namespace creation. It helps in running multiple controller processes on the master node albeit compiled together for running as a single process.
Q19. What are different types of controller manager?
Answer: You can find Kubernetes architecture interview questions such as “What are different types of controller manager?” The notable controller managers that can run on the master node are node controller, service account and token controller, endpoints controller, and replication controll
Q20. What is a load balancer in Kubernetes?
Answer: It is also an important interview question commonly asked in a Kubernetes interview. You can state that load balancer is a method for exposing service, and two types of load balancers can be used in Kubernetes. The two-load balancer includes external load balancer and internal load balancer.
Q21. What is a headless service?
Answer: A can also come across a different question in your Kubernetes interview such as “What is a headless service?”. Headless service can be described as any other normal service, albeit without any cluster IP.
Q22. What is a Swarm in Docker?
The docker Swarm is a clustering and scheduling tool for the Docker containers. When it comes to Swarm, the IT administrators and developers would establish and manage a cluster of Docker nodes as part of the single virtual system.
Q23. What is OpenShift?
OpenShift online is Red Hat’s public cloud application development and hosting platform which provides automation for management, provision and the scaling of application so it is possible to focus on writing the code for the business or big idea.
Q24. Can you please tell me what some of the main advantages of Kubernetes is?
With container orchestration tool Kubernetes, it has become easy for one to handle the containers. You may respond to different customer demands through deploying the applications in a faster manner and in a way, which is predictable. So there is:
• Automated rollback
• Automated scheduling
• Horizontal scaling
• Auto healing capabilities
Q25. What are K8s?
This is another term for Kubernetes, whereby (K-eight characters-S), would be the open source orchestration framework for the containerized applications. It just another name for what we call Kubernetes.
Can you tell me how you get a static IP for a Kubernetes load balancer?
The Kubernetes Master is allowed to assign a new IP static address. It is possible to get a static IP for Kubernetes load balancer through changing the DNS records.