Kubernetes is the new powerful tool on the market in the devops realm. It is making waves in terms of its recent innovations. Many companies have been created because of Kubernetes. Primarily in the devops realm but also some solutions in the on-prem territory. Kubernetes and its connection with Docker is providing the ability for engineers to service many servers and box setups in extremely easy ways. Kubernetes has created powerful bundles which has equipped ops engineers with everything they need to scale and service service setups extremely easily. Below is a list of the best Kubernetes interview questions and answers I could come up with. They are for both beginner and advanced ops engineers. As with all interview questions its important that you treat these as mock answers. You'll need to go through the questions and present your own answers, especially when in a technical interview session. Most commonly, you will be pair programming with another ops engineer. So these questions will be helpful for you in the written or verbal part of the process. But you'll still need extensive background with Kubernetes. Having personal projects you can use as examples of your experience can be very helpful.
1. Can you tell me what Kubernetes is?
Kubernetes refers to an open source system that does automating deployment, scaling as well as the management of containerized applications. It handles the grouping of containers, which make up an application into logical units for management as well as discovery.
2. What is a docker?
A docker is an open-source software development type of platform. The main advantage with it is it packages the applications in containers and allows them to remain portable among any system, which is running a Linux type of operating system.
3. What is Orchestration in the Kubernetes software?
Application orchestration. The application or service orchestration refers to the process of integrating two or more applications or services together for them to automate the process or to synchronize the data in real time. Usually the point-to-point integration could be used as a path for the least resistance.
4. How is Kubernetes related to Docker?
Docker is responsible for the management of the lifecycle of containers and these are manually linked and orchestrated with Kubernetes.
5. What are the scenarios in which a Java Developer is going to use Docker?
Following scenarios a java developer can use docker:
• Running UAT’s with the use of Docker.
• Sharing development workspace, with pre-configured development environment.
• Continuous integration is a popular use case for Docker. The teams looking build and deploy their applications may use Docker combined with ecosystem tools such as Jenkins to drive applications from development, testing, staging and into production without the need to change any code.
6. What are Daemon sets?
The Daemon set is a set of pods that is run only once on a host. It can be used for host layer attributes like a network, host monitoring or the storage plugin or things, which you would not want to run more than once on a host.
7. What is Master?
Master refers to a central control point, which gives a unified view of a cluster. There is a single master node, which controls different minions. Master servers then work together to accept user requests and determine the best means of scheduling the workload containers, authenticate clients and nodes as well as adjust on the cluster wide networking and managing the scaling and health checking of responsibilities.
8. What are minions?
A node is a worker machine or slave within Kubernetes, which is previously or sometimes referred to as a minion. A node may be a VM (virtual machine) or physical machine that acts as a dependent on the cluster. Each node has the services needed to run the pods and is managed by the master components. The services on each of the nodes includes the container runtime, Kube-proxy and Kubelet.
9. What are labels and annotations when it comes to Kubernetes?
A label in Kubernetes is a meaningful type of tag word, which is attached to the Kubernetes objects in order to make them as part of a group. The Labels may be used for working on different instances for the purposes of management or even routing purposes. For one, the controller-based objects may use the labels to mark the pods they would operate on. The Micro services use labels to understand the structure of the backend pods they route the requests toward. The labels are some of the key value pairs. Each unit may have more than one label but each unit may only have one entry for each of the keys. The key is utilized as an identifier. However, at the same time may classify the objects using other criteria according to public access, application versions and the developmental stages.
The annotations attach arbitrary key value information to the Kubernetes object. The levels, however, ought to be utilized for meaningful information in order to match a pod with selection criteria, so the annotations have less structured data. The annotations are a means for adding more metadata to the object, which is not helpful for the selection purposes.
10. What are the node server components for Kubernetes?
In Kubernetes the server do their work through running containers, which are known as nodes. The execution of tasks and reporting the status to the master would be the main objective of the Node server.
The main process of the Kubernetes node, which does some of the significant container operations:
• The Kubelet is the node-daemon, which communicates with Kubernetes master for all the machines, which are a part of a Kubernetes cluster.
• It regularly accesses the controller in order to check and report on the status of the cluster.
• It merges the available CPU, memory and disk for a node into the large Kubernetes cluster. It also communicates the state of the containers back up to the API server for control loops in order to observe the current state of the containers.
11. What is the difference between deploying applications on hosts and on containers using Kubernetes?
This kind of architecture is going to have an operating system (or OS) and that OS will have a kernel that will have different libraries installed on it for the parts of the application. In this framework, it is possible to have n number of applications and all of them are going to share the libraries, which are present within the operating system though while deploying the applications in containers, the architecture can be a bit different from one another. This architecture approach will have a kernel. And that kernal may be the only thing which will be common between all of the applications. If there is a particular one, which requires Java, then that one will get access to it. That means the applications would have the required libraries and binaries, which are isolated from the system and these cannot be encroached by other applications.
12. Can you describe what a cluster is in Kubernetes?
These master and node machines are the ones, which run the Kubernetes cluster orchestration system. A container cluster is the core foundation of the Container Engine. The Kubernetes objects, which represent the containerized applications, are there to run on top of the cluster.
13. What's a Swarm in Docker?
Docker Swarm is a clustering and scheduling tool for Docker containers. When it comes to Swarm, the IT administrators and developers (or devops engineers) would establish and manage a cluster of Docker nodes as part of the single virtual system.
14. What is OpenShift?
OpenShift online is Red Hat’s public cloud application development and hosting platform which provides automation for devops management, provisioning and the scaling of the applications so it is then possible to focus on writing the code for the business. It allows easability.
15. What does the nodes status contain?
Some of the following things would be the main components of the node status.
16. What are Pods in Kubernetes?
A Kubernetes pod is a particular group of containers, which are deployed, in the same host. The Pods have the capacity to operate on a level, which is higher as compared to the individual containers. That is because the pods have the group of containers, which work together to produce an artifact or to process a particular set of work.
17. What is Namespace within Kubernetes?
Namespaces are meant for use within environments that have a number of users that are spread across different teams or projects. The Namespaces are a means of dividing cluster resources between the different uses. In future versions or releases of Kubernetes, the objects within the same Namespace are going to have a similar access control policies by default.
18. Describe what a node is within Kubernetes.
A node represents a worker machine in Kubernetes that is previously referred to as a minion. A node may be a VM (or Virtual Machine) or physical machine that is depending on the cluster as a whole. Each of the nodes has the services, which are needed in order to run the pods and is managed by the master components. The services on the node would include the Docker, Kubelet and Kube-proxy.
19. Why do we like to utilize Docker?
Docker gives the same capability without the operational overhead that comes with a virtual machines or VM's. It allows one to place their environment and the configuration into code and then deploy it. The same Docker configuration may be used as well for different environments. That would decouple the infrastructure needs from the application environment.
20. What is a Docker in the Cloud?
The node is an individual Linux host that is used for the purposes of deploying and running the applications. Docker cloud does not give the hosting services so the services, applications and containers run on your particular hosts. The hosts may come from different sources such as physical servers, virtual machines or even cloud providers.
21. How would you describe what a cluster of containers is?
The container cluster refers to a set of compute engine instances, which are the nodes. It also is responsible for creating routes for the nodes so the containers running on the nodes may communicate with each other. The Kubernetes API server does not according on the particular cluster nodes. Rather think of it as the Container Engine hosting the API server.
22. What is Container Orchestration in Kubernetes?
Consider a scenario or application where there are 5 to 6 microservices for the application as a whole. These microservices are then placed within individual containers but they are not going to be able to communicate without the container orchestration. Therefore as orchestration means the combination of all of the instruments playing together in harmony in music, container orchestration would mean all of the services within the individual containers working together in order to fulfill the requirements of a single particular server.
23. What is the significance of Container Orchestration?
Consider there are 5 to 6 micro-services for a single application performing different asks and all of them are placed within containers. In order to make sure the containers communicate with each other properly and without errors, there is a need for a container orchestration.
24. What are some of the different attributes of Kubernetes?
• Automated scheduling: Kubernetes allows advanced scheduler to launch container on the particular cluster nodes.
• Automated rollouts and rollback: Kubernetes supports the different rollouts and rollbacks for the desired state of the containerized application.
• Self-healing features: rescheduling, replacing and restarting the containers, which are dead.
• Horizontal scaling and load balancing: Kubernetes may scale up and down the application according to the requirements.
25. What are the means by which Kubernetes simplifies containerized Deployment?
As a typical application would be a cluster of containers running across different hosts or servers, these containers would need to communicate with each other. In order to do this, there would have to be something big, which would load balance and scale & monitor the containers. Because Kubernetes is a cloud agnostic and may run on private as well as, public providers it has to be ones choice to simplify the containerized deployment.
26. What are the main advantages of Kubernetes to you?
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
27. What is the difference between Docker Swarm and Kubernetes?
• The installation structure of Kubernetes is complex though if it were installed then the cluster would be robust. However, the Docker Swarm installation process happens to be simple though the cluster is not robust per se.
• Kubernetes is very scalable and scales fast. However, the Docker swarm scales are five times faster than Kubernetes and is very scalable.
• Kubernetes may also do the process of the auto scaling though the Docker swarm cannot do the process of the auto scaling.
28. What is heapster?
Heapster refers to a cluster wide aggregator of data that is provided by Kubelet running on each of the nodes. This container management tool is supported natively on Kubernetes cluster and runs as a pod in the same way as any other pod within the cluster. Because of this it discovers all the nodes within the cluster and queries the usage information from the Kubernetes nodes in the cluster through an on machine Kubernetes agent.
29. What is the Google Container Engine as it relates to Kubernetes?
Google Container Engine or GCE refers to the open source management platform for the Docker containers and the clusters. The Kubernetes based engine supports the clusters that run within the Google’s public cloud services. This is basically a way to synchronize some of Google's ops softwares and Kubernetes.
30. What can you say is positive about the clusters within Kubernetes?
The fundamental behind Kubernetes is it is possible to enforce a desired state management though which it is possible to feed the cluster services of a particular configuration and this is going to be up to the cluster services to go out and run the configuration within the infrastructure. As such, the deployment file is going to have all of the configurations needed to be fed within the cluster services. The deployment file is also going to be fed to the API and then it would be up to the cluster services to ascertain the means to schedule these pods within the environment and make certain the right number of pods are running. In so doing the API that sits in front of the services, the workers nodes and even the Kubelet process, which the nodes run, all make up the Kubernetes cluster.
31. What is Minikube?
Minikube refers to a tool that makes it easier to run the Kubernetes locally. This runs a single node Kubernetes cluster within a virtual machine.
32. What is Kubectl?
Kubectl refers to a platform using which you may pass commands to the cluster. In so doing, it provides the CLI with the means to run commands against the Kubernetes cluster with different means to create and manage the Kubernetes component.
33. What is Kubelet?
The Kublet refers to an agent service that runs on each node and allows the slave to communicate with the master. Therefore, Kubelet works on the description of the containers that are provided to it within the PodSpec and makes sure the containers prescribed within the Podspec are health and running adequately.
34. What is K8s?
This is another term for Kubernetes, whereby (K-eight characters- S), would be the open source orchestration framework for the containerized applications.
35. What is the Kube Proxy for Kubernetes?
The Kubernetes network proxy runs on each one of the nodes. The service cluster IPs and ports are found through the Docker links compatible environment variables specifying the ports opened by the service proxy. This is an alternative which gives the cluster DNS for the cluster IP addresses.
36. What is the process that runs on Kubernetes Master Node?
Kube-apiserver process runs on Kubernetes master node.
37. Can you discuss the inner workings of the master node in Kubernetes?
Kubernetes master controls the nodes and the containers are within the nodes. These individual containers are had within pods and inside each pod, based according to the configuration and requirements. If the Kubernetes pods have to be deployed then they may either be deployed using a user interface or command line interface. Then these pods would be scheduled on the nodes and based on the source requirements, the pods are then allocated to these nodes. The Kube API server makes certain there is communication between the Kubernetes node and its master components.
38. What is the role of the Kube apiserver and the Kube scheduler?
The Kube apiserver follows the scale out architecture and is the front end when it comes to the master node control panel. That would expose all the APIs of the Kubernetes Master Node components and is responsible for the establishment of communication between the Kubernetes node and the Kubernetes master components. The Kube scheduler would then be responsible for the distribution and management of workload on the worker nodes. It would select the most suitable node to run the unscheduled pod depending to resource needs and keeps track of the resource utilization. It makes certain the workload is not scheduled on the nodes that may already be full.
39. What is the process that validates and configures data for the API objects such as the Pods services?
Kube apiserver process validates and configures the data for the API services.
40. What is the use of the Kube controller manager?
Kube apiserver process validates and configures the data for the API objects.
41. Kubernetes Objects consist of what?
Kubernetes objects are made of Pod, Service and OLUME.
42. What are the Kubernetes controllers?
The Kubernetes controllers include Deployment controller and Replicaset.
43. What is ECTD?
ECTD is written in a Go Programming language and is distributed key value store utilized for coordinating between the distributed work. As such, the ECTD stores of the configuration data of the Kubernetes cluster which show the state of the cluster at any time.
44. Describe the different types of services within Kubernetes.
• Cluster IP: this exposes the services on a cluster internal IP. It is also the default service type and makes the service only reachable from inside of the cluster.
• Node Port: it is a Cluster IP service to which Node Port service is going to route and is automatically created. It also exposes the service on each Node IP at a static port.
• External Name: this maps the service to the contents of the External Name field through returning a CNAME record with that particular value. There is no proxying of any sort, which is set up.
• Load Balancer: this one exposes the services from an external perspective with the use of a cloud provider’s load balancer. The services to which the external load balancer are going to route are automatically created.
45. What is the Cloud Controller manager?
The Cloud Controller manager is there for persistent storage, abstracting the cloud particular code from the main Kubernetes specific code and management of the communication with underlying cloud services. It may be split into different containers as depending on the cloud platform that is being run and then it allows the cloud vendors and Kubernetes code to be developed without an element of inter dependency. Therefore, the cloud vendor develops their code and then connects with the Kubernetes cloud controller manager while running the Kubernetes. There are different forms of cloud controller manager and they include the following:
• Node controller: this one checks and confirms the node is deleted in a proper manner after having been stopped.
• Volume controller: this one manages the storage volume and interacts with the cloud provider in order to orchestrate the volume.
• Service controller: the service controller is there for the management of the cloud providing the load balancers.
• Route controller: the route controller manages the traffic routes within the underlying cloud infrastructure.
46. What is ingress network and what are the ways in which it works?
The Ingress network represents a collection of rules, which act as an entry point to the Kubernetes cluster. This would allow for inbound connections that can be configured to provide the services externally through URLs, which are reachable, through offering name, based virtual hosting or through load balance traffic. Ingress, therefore is an API object, which handles the external access to the services within a cluster usually through the means of HTTP and would be the best way of exposing service. The working of the ingress network can be illustrated through the following example. There are 2 nodes having the POD and root network namespaces with a Linux bridge. At the same time, there should be a new virtual Ethernet device which is known as flannel0 (network plugin) that is added to the root network. Consider now that you may want the packet to flow from the first to the fourth pod. You can refer to the diagram below.
• From the above figure, the packet leaves pod1’s network at eth0 and then enters the root network at veth0.
• Then it is passed to CBR0, and that makes the ARP request to find the destination and it is found no one on this node would have the destination IP address.
• As such, the bridge then sends the packet to flannel0 as the node’s route table is configured with flannel0.
• So the flannel daemon talks to the API server of Kubernetes in order to know all of the pod IPs and their respective nodes to create a mapping for the pods IPs to the node IPs.
• The network plugin also wraps this packet within a UDP packet with extra headers changing the source and destination IPs to their respective nodes and sends the packet out through eth0.
• Since the route table already knows the way to route traffic between the different nodes, it sends the packet to the destination node2.
• The packet then arrives at eth0 of node2, and then goes back to flannel0 in order to de-capsulate and then emits it back in the root network namespace. Similarly, the packet is forwarded to the Linux bridge in order to make an ARP request to ascertain the IP, which belongs to veth1.
• The packet then crosses the root network and reaches the destination, which is Pod4.
47. What are the disadvantages of Kubernetes?
• It is hard to install and configure.
• It takes time to start running and gain traction.
• There are no placements available as yet.
• It is not simple to manage the services.
48. What is a headless service?
A headless service is almost the same to that of a ‘Normal’ services but does not necessarily have a Cluster IP. This service allows you to directly reach the pods without having to access it through the means of a proxy.
49. What are federated clusters?
Multiple clusters may be managed as a single cluster with the assistance of federated clusters. It is possible to create multiple clusters within the data center or cloud and then use the federation for controlling or managing them in one place. The federated clusters are able to achieve this by doing some of the following:
• Syncing resources across the different clusters: this keeps the resource sync across the different clusters in order to deploy the same deployment set across the different clusters.
• Cross Cluster, discover: this provides the ability to have DNS and Load Balancer with backend from the participating clusters.
50. What is the difference between the replication controller and a replica set?
The replica set and replication controller do about the same things. Both of them make certain that a specified number of pod replicas are running at the same time. The difference is there with the use of selectors to replicate the pods. The replica Set utilize Set Based selectors though the replication controllers utilize Equity Based selectors.
• Equity Based Selectors: this type of selector allows for filtering through the label key and values. That means the equity-based selector is only going to search for the pods that are going to have the same exact phrase as compared to the label. An example in this case is considering the label key claims app=nginx. That means with this selector it is possible to only look for these pods with label app equal to nginx.
• Selector based selectors: this selector allows for the filtering of keys according to a set of values. That means the selector-based selector is going to search for the pods whose label has been mentioned within the set. For example, if the label key says app within (nginx, Apache or NPS). With this selector, if the app is equal to any of the nginx, Apache or NPS then the selector is going to take it as a true result.
51. How do you get a static IP for Kubernetes load balancer?
Kubernetes Master assigns a new IP address. It is possible to get a static IP for Kubernetes load balancer through changing the DNS records.
Still need more?
Below is a really helpful introduction video about Kubernetes that was made by VMWare. It can be helpful to see how others explain Kubernetes. This is a powerful tool to get equipped with the correct language before your interview sessions. Here's one of my favorites:
They really do a fantastic job of showing you the power packed into Kubernetes. This same power is what you can reiterate to your future employer. I hope this short 5-minute video on Kubernetes was helpful.