Kubernetes Interview Questions and Answers
Q1. What is Kubernetes?
Ans: Kubernetes is an open-source container orchestration system for deploying, scaling, and managing the automated application. It offers an excellent community and works with all cloud providers. Hence, it is a multi-container management solution.
Q2. What is a container?
Ans: Containers are a technology for collecting the compiled code for an application when it is required at run-time. Each container allows you to run repeatable, standard dependencies and the same behaviour whenever the container runs. It divides the application from the underlying host infrastructure to make the deployment much easier in cloud or OS platforms.
Q3. What are the nodes that run inside the Kubernetes?
Ans: A node is a worker machine or VM depending on the cluster. Each node contains services to run the pods and the pods are managed by the master components.
Q4. What are the services that a node gives and their responsibilities?
Ans: The services that include in a node is as follows:
- Container run-time
The Container run-time is responsible to start and manage the containers. The kubelet is responsible for running the state of each node and receives commands from the master to work on it and it is also responsible for the metric collection of pods. The Kube-proxy is a component that manages the subnets and makes services available for all other components.
Q5. What is a master node in Kubernetes?
Ans: A master node is a node that controls and manages the set of worker nodes and resembles a cluster in Kubernetes.
Q6. What are the main components of the master node?
Ans: The main components of the master node that help to manage worker nodes are as follows:
- Kube-server: It acts as a frontend of the cluster and communicates with the cluster through API server.
- Kube controller: It implements governance across the cluster and runs the set of controllers for the running cluster.
- Kube scheduler: It schedules the activities of the nodes and holds the node resource to determine proper action for triggering events.
Q7. What is a pod and what does it do?
Ans: A pod is a group of containers that are deployed together on the same host. It is the basic execution unit of the Kubernetes application that can create or deploy the Kubernetes unit of object models.
Kubernetes pods can be used in two ways. they are as follows:
i. Pods that can run in a single container
ii. Pods that can run with multiple containers when it is required to work together
Q8. What are the different types of multiple-container pods?
Ans: There are three different types of multi-container pods. They are as follows:
- Sidecar: The Sidecar pattern is a single node pattern made of two containers of the application. It contains a core logic of the application and it sends the logic files to the bucket.
- Adapter: It is used to standardize and normalize the output application or monitor data for aggregation. It performs restructuring, reformatting and can write the correct formatted output for the application.
- Ambassador: It is a proxy pattern that allows connecting other containers with a port on the localhost.
Q9. What is the Namespace? How many namespaces are there in Kubernetes?
Ans: Namespace is used to work with multiple teams or projects spread across. It is used to divide the cluster resources for multiple users.
Q10. Mention different kinds of Namespaces in Kubernetes?
Ans: The namespaces are of three kinds. They are:
i. Default: The default namespace that when the cluster comes out of the box with no other namespaces
ii. Kube-system: The namespace for objects created by Kubernetes.
iii. Kune-public: The namespace that can create automatically and it is visible and readable publicly throughout the whole cluster. The public aspect of this namespace is only convenient and reserved for cluster usage.
Q11. How are Kubernetes related to docker?
Ans: Docker provides the lifecycle management of a container and the docker image builds the run-time of a container. The containers run on multiple hosts through a link and orchestrated using Kubernetes. Dockers build these containers and help to communicate with multiple hosts through Kubernetes
Q12. Mention the difference between Kubernetes and a docker?
Subscribe to our youtube channel to get new updates..!
|Installation and cluster configuration||The installation process is very complicated but once it has done, the Cluster is robust.||The installation is very simple, but it does not have a robust cluster.|
|Auto-scaling||It can do Auto-scaling||It cannot do Auto-scaling|
|Data volumes||It can store data only with other containers on the same pod||It can store data on any other containers|
|Logging and monitoring||It is an in-built tool for logging and monitoring||It is a third-party tool, uses ELA stack for logging and monitoring|
Q13. Why do we need Container orchestration in Kubernetes?
Ans: Container orchestration is used to communicate with several micro-services that are placed inside a single container of an application to perform various tasks.
The use of container orchestration is as follows:
- It controls and automates various tasks such as deployment, scaling, etc.,
- Reduces the complexity running time
- Scaling becomes easy
- It is used to deploy and manage complex containerized applications
- Reduces manual setting up services
Q14. What are the tools of container orchestration?
Ans: There are many Container orchestration tools that provide a framework for managing microservices and containers at scale. The popular most tools for container orchestration are as follows:
- Docker swarm
- Apache Mesos
Q15. What are the major operations of Kubelet as a node service component in Kubernetes?
Ans: The major operations that the Kubelet do as follows:
- The Kubelet is a node that communicates with master components to work on all the parts of the Kubernetes cluster.
- It merges the available CPU, memory, and disk of a node into a large Kubernetes cluster.
- It provides access to the controller to check and report the status of the cluster.
- It is responsible for the collection of metric pods
Q16. Mention the list of objects of Kubernetes?
Ans: The following are the list of objects used to define the workloads.
- Replication sets and controllers
- Distinctive identities
- Stateful sets
- Daemon sets
- Jobs and cron jobs
Q17. What is the difference between the pod and the container?
Ans: Pods are the collection of containers used as the unit of replication in Kubernetes. Containers are the set of codes to compile in a pod of the application. Containers can communicate with other containers in the same pod.
Q18. Explain Stateful sets in Kubernetes?
Ans: Stateful set is a workload API object used to manage the stateful application. It is used to manage the deployments and scaling the sets of pods. The state information and other resilient data of stateful pods were stored and maintained in the disk storage that connects with the stateful set.
Q19. How to determine the status of deployment?
Ans: To determine the status of the deployment, use the command below:
kubectl rollout status
If the output runs, then the deployment is successfully completed.
Q20. Explain Replication controllers?
Ans: Replication controllers act as supervisors for all long-running pods. It ensures that the specified number of pods are running at the run-time and also ensures that a pod or a set of pods are homogeneous in nature. It maintains the desired number of pods if the number of pods it will terminate the extra pod. And if there is a failed pod, the controller will automatically replace the failed pod.
Q21. What are the features of Kubernetes?
Ans: The features of the Kubernetes are as follows:
- It provides an automated and advanced scheduler to launch the containers on the cluster
- Replacing, rescheduling, and restarting the containers that are failed while compilation
- It supports rollouts and rollback for the desired state of the containerized application
- It can scale up and scale down as per the requirements.
Q22. What is kubectl?
Ans: Kubectl is the command-line tool used to control the Kubernetes clusters. It provides the CLI to run the command against clusters to create and manage the Kubernetes components.
Q23. What is the Google container engine?
Ans: The Google Container Engine (GKE) is the open-source management for the Docker containers and the clusters. This Kubernetes based container engine supports only for the clusters that run within the Google public cloud service.
Q24. What are the different types of services in Kubernetes?
Ans: The different types of services that support Kubernetes are as follows:
- Cluster IP: It exposes the services on cluster internal IP and makes the services reachable within the cluster only.
- Node port: It exposes the services on each node’s IP at the static port.
- Load balancer: It provides services externally using a cloud provider’s load balancer. It creates the service to route the external load balancer automatically.
- External name: It navigates the service to the contents of the external field by returning the CNAME record by its value.
Q26. Mention the various container resource monitoring tools?
Ans: The various container monitoring tools are as follows:
Q27. What is Heapster?
Ans: Heapster is a performance monitoring and a metric collection system. It provides cluster-wide data aggregation by running with a kubelet on each node. It allows for the collection of metrics, pods, workloads, containers, and other signals that are generated by the clusters.
Q28. Explain Daemon sets?
Ans: A daemon set ensures that all the eligible nodes run a copy of the pod runs only once in a host. It was created and scheduled by the daemon controller. It is a process that runs in the background and does not produce any visible output.
Q29. What are the uses of Daemon sets?
Ans: The uses of Daemon sets are as follows:
It runs cluster storage such as ceph, glusterd on each node.
It runs the logs collection of daemons on every node such as fluentd or filebeat.
It runs a node monitoring on every node.
Q30. Explain Replica set?
Ans: A Replica set is used to maintain a stable set of replica pods. It is used to specify the available number of identical pods. It was also considered as a replacement for the replication controller sometimes.
Q31. What is ETCD in Kubernetes?
Ans: ETCD is the distributed key-value store. It stores and replicates the configuring data of the Kubernetes cluster.
Q32. Explain the Ingress controller?
Ans: Ingress controller is a pod that acts as an inbound traffic handler. It is responsible for reading the ingress resource information and processing the data accordingly.
Q34. What is the based selector that is used in the replication controller?
Ans: The Replication controller uses the Equity-Based selector that allows filtering by labels key and values. It only looks for the pods which have the same values as that of the label.
Q35. Explain the Load balancer in Kubernetes?
Ans: The load balancer is a way of distributing the loads, which is easy to implement at the dispatch level. Each load balancer sits between the client devices and the backend servers. It receives and distributes the incoming requests to all available servers.
Q36. Explain the two different types of load balancers?
Ans: The two different load balancers are one is an internal load balancer that balances the load and allocates the pods automatically with the required configuration. And the other is the External load balancer that directs the traffic from external loads to the backend pods.
Q37. What is Minikube?
Ans: Minikube is a type of tool that helps to run the Kubernetes locally. It runs on a single-node Kubernetes cluster inside a Virtual machine (VM).
Q38. What are the uses of Google Kubernetes Engine?
Ans: The uses of Google Kubernetes Engine are as follows:
- It creates the Docker container cluster
- It resizes the application controllers
- It creates the containers pods, load balancer, services, replication controller
- It updates and upgrades the container cluster
- It helps to debug the container cluster
Q39. Explain Prometheus in Kubernetes?
Ans: Prometheus is an open-source toolkit that is used for metric based monitoring and alerting the application. It provides a data model and a query language and can provide details and actions of metrics. It supports the instrumental application language for many languages. The Prometheus operator provides easy monitoring for deployments and k8s services, besides Alertmanager and Grafana.
Q40. What is the role of clusters in Kubernetes?
Ans: Kubernetes allows the required state management by cluster services of a specified configuration. These cluster services run the configurations in the infrastructure. The following are the steps that are involved in this process as follows:
- The deployment file contains all the configuration that is fed into the cluster
- These deployments are fed into the API server
- The cluster services will schedule the pods in the environment
- It also ensures the right number of pods were running
Q41. What is the Cluster IP?
Ans: The cluster Ip is a default Kubernetes service that provides a link between the pods or map container port and the host ports. It provides the services within the cluster and gives access to other apps which are inside the same cluster.
Q42. What are the types of controller managers?
Ans: The Different types of controller managers that can run on the master node are as follows:
- Endpoints controller
- Namespace controller
- Service account controller
- Replication controller
- Node controller
- Token controller
Q43. What is the Kubernetes architecture?
Ans: The Kubernetes architecture provides a flexible, coupled mechanism for the service. It consists of one master node and multiple containers. The master node is responsible for managing the clusters, API, and scheduling the pods. Each node runs on the container runtime such as Docker, rkt along with the node that communicates with the master.
Q44. What are the main components of Kubernetes architecture?
Ans: The two main components of the Kubernetes architecture are as follows:
- Master node
- Worker node
Each node contains the individual components in it
Q45. Define Kube-api server?
Ans: The Kube-api is the frontend of the master node that exposes all the components in the API server. It provides communication between the Kubernetes nodes and the master components.
Q46. What are the advantages of the Kubernetes?
Ans: The advantages of the Kubernetes are as follows:
- Kubernetes is open-source and free
- It is highly scalable and runs in any operating system
- It provides more concept and more powerful that Docker swarm
- It provides scheduler, auto-scaling, rolling upgrades, and health checks
- It has a flat network space and a customized functionalities
- It is easy to make effective CI/CD pipelines
- It can improve productivity
Q47. What are the disadvantages of Kubernetes?
Ans: The disadvantages of the Kubernetes are as follows:
- The installation process and configuration is highly difficult
- It is not easy to manage the services
- It takes a lot of time to run and compile
- It is more expensive than the other alternatives
- It can be an overkill for simple applications