Recently asked Kubernetes Interview Questions and Answers
The latest Kubernetes Interview Questions and Answers are as follows-
Q1) What is Kubernetes?
Answer: Kubernetes is an extensible, portable, and open-source platform used for managing services and containerized workloads. It is a large and fast-growing ecosystem as its services, tools, and supports are frequently and widely available.
Q2) Describe the history of Kubernetes?
Answer: Kubernetes word has been originated from Greek with the meaning pilot or helmsman. It was foremostly designed by Google in 2014. It has become the building block for running the workload productions at scale for Google. Later it has been maintained by Cloud Native Computing Foundation.
Q3) What are the major differences between Kubernetes and Docker Swarm?
|Application definition||The application is set up using a consolidation of pods and deployments.||In this, the applications are set as micro-services.|
|Logging and monitoring||Kubernetes supports multiple versions of monitoring and logging.||It is supported for only auditing of third-party applications.|
|Scalability||Highly scalable||More scalable when compared to Kubernetes|
|Networking||In this the networking model is flat.||The overlay of the network is created by joining a node with the cluster.|
|Availability||It provides a huge amount of availability among the nodes.||It also provides large and more availability for the services that are depicted in Swarm|
Q4) What is are the reasons why Kubernetes is more useful by walking back in time?
Answer: Kubernetes mainly contains three important deployments. They are:
- Traditional Deployment
- Virtualized Deployment
- Container Deployment
These three are the most crucial aspects that are useful by going back in time
Earlier in this era, applications can run on the physical servers by various organizations. This causes allocation issues related to resources, which can be solved by running each and every application on the different servers.
The introduction of virtualization was done so, that it allows us to run many numbers of virtual machines on only one server CPU.
Container deployment has flexible isolation properties in order to share an operating system among applications.
Q5) Why do we need Kubernetes and what it can do?
Answer: Kubernetes is the container that provides a good way to run and bundle your applications. We need to effectively manage the containers in the production environment that allows us to run applications. It also provides a framework to run distributed systems resiliently.
Q6) What are the features of Kubernetes?
Answer: The features of Kubernetes are as follows:
- Storage orchestration
- Automated rollbacks and rollouts
- Configuration management
- Packing of bin automatically
- Load balancing and service discovery
Q7) List out the components of Kubernetes?
Answer: There are mainly three components to deliver a functioning Kubernetes cluster. They are:
- Node components
- Master components
Q8) How does Kubernetes relate to Docker?
Answer: Kubernetes is a container for the Docker which is more comprehensive than Docker Swarm and is designed to counterpart clusters of the nodes at a level in a well-defined manner. Whereas, Docker is the platform tool for building and running the Docker containers.
Q9) Define Kube Scheduler?
Answer: It is the important aspect of the master node which notices the newly created pods with no assigned node for it, and selects one of the nodes to run on them.
Q10) What are the benefits of Kubernetes?
Answer: The benefits of Kubernetes are as follows:
- It provides easy service organizations with pods.
- It works on any of the OS as it an open-source modular tool.
- It has a huge community among container orchestration tools.
Q11) Define Kubernetes Namespace?
Answer: Namespaces are used in environments where there are multiple users in a respective team or project. It is mainly designed to provide scops for the names and the assigned names must be unique within the namespace. Moreover, they provide a way to divide cluster resources within the existing namespace itself.
Q12) Mention the namespaces that initially the Kubernetes start with?
Answer: Initially the Kubernetes starts with three namespaces, and they are:
Kube-public: This is created automatically and can be read by all the users and it is the most reserved for cluster usage.
default: It is for the objects who do not contain namespaces.
kube-system: It is for the objects which are created by the Kubernetes system.
An example of the initial namespaces in Kubernetes is given below:
kubectl get namespace
Q13) What are Kubernetes pods?
Answer: Pods are defined as the group of containers that are set up on the same host. Applications within the pod also have access to shared volumes.
Q14) Define Kubelets?
Answer: It is the node agent that runs on each node. It works based on PodSpec, which JSON object in terms of a pod. The Kubelet logs take a set of PodSpecs that provides various mechanisms and ensures that the PodSpecs are running effectively.
Q15) What are the command Kubectl and its syntax?
Answer: It is defined as a CLI (command-line interface) for performing and running commands against Kubernetes clusters.
The syntax for Kubectl is
kubectl [command] [TYPE] [NAME] [flags]
Q16) How does the Kubernetes Cluster work?
The master is the one who is responsible for managing clusters. Kubernetes automates the scheduling and distribution of application containers across the cluster in a more effective manner. In Kubernetes, Minikubes are used to create clusters. The Kubernetes cluster consists of mainly two important sources, and they are:
- The master coordinates the cluster
- Nodes are the workers who run applications
Q17) What do you understand by the term Kube-proxy?
Answer: This is a network-proxy that runs on each and every node and also reflects as defined in the Kubernetes API. This proxy can also perform stream forwarding across a set of backends. It is one of the optional add-ons that provide the DNS cluster for the cluster APIs.
The syntax to configure Proxy is:
Q18) Describe in brief the working of the master node in Kubernetes?
Answer: Kubernetes master is mainly designed to control the nodes and the nodes mainly consist of a crucial part called containers. Now, here comes the pods these pods are made up of a group of containers based upon the requirements and configurations. Every container which we utilize is present inside a pod so, if the set-up for the pod is made then the can deploy using CUI (Command Line Interface). Scheduling of the pods is done based on the node and relevant requirements. The connection between the node and the master components in the Kubernetes is made using the Kube-apiserver.
Q19) What is the function of Kube-apiserver?
Answer: This API server of Kubernetes is mainly used to configure and validate API objects that include replication controllers, services, pods, and many more. Kube-apiserver services the REST operations and provides the frontend to the cluster’s shared region through which interaction takes place between the components.
The representation for Kube-apiserver is provided as follows:
Q20) What is the role of a Kube-scheduler?
Answer: It is defined as a workload-specific, policy rich, and topology-aware function which majorly impacts on availability, capability, and performance. The duty of the scheduler is to collect individual and collective resource requirements, data locality, hardware/software policy constraints, inter-workload interference, and many more into its account. API shows or displays the necessary workload requirements.
The representation for the Kube-scheduler is:
Q21) Describe a few words about Kubernetes Controller Manager?
Answer: Kube-controller-manager is a divinity that embeds the crucial core control loops shipped with the Kubernetes. In most of robotic and automation applications, control loops are the non-terminating loops that regulate the state of the particular system. In Kubernetes, the controller itself is the control loop that watches the shared state of the cluster using the apiserver. Examples of the controllers that ship today with Kubernetes are namespaces, replications, and many more.
The representation for the Kube-controller-manager is given as:
Q22) What do you mean by the term etcd?
Answer: Kubernetes uses etcd to store all its data. The reason behind it is that Kubernetes is a distributed system so as to store distributed data it uses etcd. Etcd s a distributed, most reliable key-value for storing the most critical data.
Q23) Define the term Minikube in Kubernetes?
Answer: To easily learn Kubernetes locally minikube tools is used. This runs on the single-node Kubernetes cluster inside a virtual machine.
Q24) What is Kubernetes load balancing?
Answer: The process of load balancing lets you show or display the services. There are two types of load balancing in kubernetes, and they are:
- Internal load balancing
- External load balancing
Internal load balancing:
This balancing is used to balance the loads automatically and allocates the pods within the necessary configuration.
External load balancing:
It transfers or drags the entire traffic from the external loads to backend pods.
Q25) List out the components that interact with the node interface of Kubernetes?
Answer: The following are the components that interact with the node interface of Kubernetes, and they are:
- Node Controller
Q26) Name the process which runs on Kubernetes Master Node?
Answer: The process that runs on Kubernetes Master Node is called the Kube-apiserver process.
Q27) What are Kubernetes Minions?
Answer: Node in the Kubernetes is called as minions previously, it is a work machine in the Kubernetes. Each and every node in the Kuberntes contains the services to run the pods.
Q28) What is heapster?
Answer: Heapster is a metrics collection and performance management system for the Kubernetes versions. It allows us for a collection of workloads, pods, and many more.
Q29) Explain Kubernetes architecture with a neat diagram?
Q30) What is the future scope for Kubernetes?
Answer: Kubernetes will become one of the most used operating system (OS) for the cloud in the future. The future of Kubernetes mostly lies in virtual machines (VM) than n containers.
Q31) What do you mean by Kubernetes?
Kubernetes is a technology developed by Google Research and Development Team, is available open-source. Kubernetes allows Docker containers to establish multiple services at a time. Simply, it is a container management tool designed to work in different types of platforms. This tool is widely used to automate, scale, monitor, manage and deploy container-based applications.
Q32) State the important features of Kubernetes.
The features of Kubernetes are stated as follows:
- It provides a better infrastructure for Container-based applications
- It provides uninterrupted development services, deployment services, and integration services.
- It schedules operations automatically.
- It restores a database or program to a previously defined state automatically.
- It grades operations according to a scale automatically.
- It corrects errors automatically.
Q33) What are the differences between Docker Swarm and Kubernetes?
|Installing and Configuring the clusters is very easy but the clusters were not resilient||Installing and Configuring the clusters is very difficult but the clusters were resilient (strong)|
|Docker Swarm does not contain GUI||Kubernetes dashboard is present in a GUI|
|Scales good with five times more faster than Kubernetes||Scales faster but slower than Docker swarm|
|Docker swarm does not scale automatically||Kubernetes scales automatically|
|Possess automatic load balancing feature through which it balances in case of any traffic between docker containers in cluster||Does not contain automatic load balancing feature and therefore require manual help in case of any traffic between containers and the pods.|
Q34) What are the components of Kubernetes Master machine? Explain
The following are the key components of Kubernetes Master machine:
ETCD: ETCD is used to store the configuration data of every node present in the cluster. It can store a good amount of key values which can be shared with several nodes in the cluster. Because of its sensitivity, Kubernetes API Server can only access ETCD. But, it contains a shared key-value store that can be accessed by everyone.
API Server: Kubernetes itself is an API server controls and manages the operations in the cluster through API Server. This server provides an interface to access various system libraries and tools to communicate with it.
Process Planner(Scheduler): Scheduling is the major component of Kubernetes Master machine. The scheduler shares the workload. The scheduler is responsible to monitor the amount of workload distributed and used in the cluster nodes. It also keeps the workload after monitoring the available resources to receive the workload.
Control Manager: This component is responsible to administer the current position of the cluster. It is equivalent to a daemon process that continuously runs in an unending loop that collects and sends the collected data to the API server. It handles and controls various controllers.
Q35) Explain the node components of Kubernetes.
The following are the major components of a server node to exchange information with Kubernetes.
Docker: Every node contains Docker to run the containers smoothly and effectively. Docker is the basic component of every node in a cluster.
Proxy service of Kubernetes: The proxy service is responsible to establish communication with the host. Every node communicates with the host through a proxy. Proxy service helps nodes to transmit data to the containers upon its request and is also responsible for load balancing. It is also responsible to control pods present in node, data volumes, creation of new containers, secrets, etc.
Service of Kubelet: Kubelet service helps every node to share information from the control pane and vice versa. Kubelet is responsible to read the details of node configuration and the write values which were present in the ETCD store. This service administers the port forwarding, protocols of the network, etc.
Q36) What do you mean by Kubernetes Namespace?
Namespaces are given to provide an identity to the user to differentiate them from the other users. Namespace assigned to a user must be unique. Through namespaces, cluster resources can be separated and shared within the assigned namespace itself.
Q37) State the functions of Kubernetes namespace.
The primary functions of Kubernetes namespace are stated below:
Namespaces assist information exchange between pod to pod through the same namespace.
They are considered virtual clusters which will be present on the same cluster.
Namespaces are used to deliver logical segregation of team and their corresponding environments.
Q38) How do you create a Namespace?
To create a namespace, the following command should be written:
kubectl create –f namespace.yml
Q39) Write commands to control the Namespace.
To control the namespace, we have to create a namespace initially:
kubectl create –f namespace.yml
Then, we have to check the available namespaces from the list:
kubectl get namespace
To get a specific namespace we require, use the following command:
kubectl get namespace<xyz>
To describe the services offered by the namespace, use the command:
kubectl describe namespace<xyz>
If you want to delete a namespace from the list, use the following command:
Note: xyz is given for example. You can give any name in the namespace region.
Q40) Explain how will you set up Kubernetes.
Virtual Data Center is the basic setup before installing Kubernetes. Virtual Datacenter is actually believed to be a set of machines that can interact with each of them through a network. If the user does not have any existing infrastructure for the cloud, he can go for setting up Virtual Data Center in the PROFITBRICKS. Once completing this setup, the user has to set up and configure the master and node. For an instance, we can consider the setup in Linux Ubuntu. The same setup can be followed in other Linux machines.
Installation of Docker is the basic setup to run Kubernetes. But, there are some prerequisites needed before installing Kubernetes. We shall install Docker initially to start with. Following steps should be followed to install Docker.
The user has to provide login credentials and log in as a root user
Install the apt package and update it if necessary. If an update is needed, use the commands:
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates.
Q41) Once the update is installed, add a new key for GPG using the command:
sudo apt-key adv
This key will be extracted from the Docker list
Further, update the image of the API package using the command:
sudo apt-get update
Install Docker Engine. Check whether the kernel version you are using is the right one.
After installing Docker Engine, install, etc. Now, install Kubernetes on the machines.
Q42) What do you know about Kubelets?
Kubelet is nothing but a node agent which runs on every node on a cluster. Kubelet works on the basis of the specifications in Pods. These Kubelets were responsible to check whether the PodSpecs is working perfectly. For this purpose, Kubelets create logs and monitor the PodSpecs.
Q43) What do you know about Pods in Kubernetes?
Pods actually contain a class of containers that are installed and run on the same host. Containers were present on pods and therefore configuring the pods as per the specifications is important. As per the requirement of the nodes in a cluster, scheduling of pods can be established.
Q44) What are the types of Kubernetes pods? How do you create them?
Kubernetes contains two kinds of Pods. They are:
Single Container Pod: The user has to give Kubectl run command where he defined the image in Docker registry to create a single container pod. The following command is used to create a single container pod:
kubectl run <abcd> –image<xyz1234> where
abcd….. name of the pod
xyz234….image name on the registry
Multicontainer pods: To create multi-container pods, we need to create a yaml file including the details of the containers. User has to define the complete specifications of the containers such as its name, image, port details, image pull policy, database name, etc.,
Q45) What is the use of the API server in Kubernetes?
The API server is responsible to provide a front end to the clusters that are shared. Through this interface, the master and node communicate with one another. The primary function of the API server is to substantiate and configure the API objects which includes pods, associated services, controllers, etc.
Q46) What do you mean by Kubernetes images?
There is no specific support to Kubernetes images as of date and Docker images actually support Kubernetes. To create an infrastructure for Containers, Docker images are the primary elements to form it. Every container present inside a pod will contain a Docker image running on it.
Q47) Tell me about the functions of Kubernetes Jobs.
The important function of Kubernetes job is to form a single or multiple pods and to monitor, log how well they are running. Jobs reflect the running of pods and they assure how many pods finished successfully. A job is said to be complete if the specified number of pods successfully run and complete.
Q48) What do you know about Labels in Kubernetes?
Keys will contain some values. Labels contain pair of key values connected to pods, associated services and the replication controllers. Generally, labels were added to some objects during creation. During run time, they can be modified.
Q49) What do you know about Selectors and what are the types of selectors in Kubernetes API?
Since multiple objects have the possibility of the same labels, selectors are used in Kubernetes. Label Selectors are unique and users use them to choose a set of objects. Till date, Kubernetes API allows two kinds of Label selectors. They are:
Selectors based on Set: This kind of selector permits filtering of the keys as per the set of values.
Selectors based on Equality: This kind of selector permit filter as per key and by value. If there is any matching object found, it should meet the expectations of the specified labels.
Q50) What do you know about Minions? Explain.
Minion is nothing but a node present in the Kubernetes cluster on a working machine. Minions can either be a virtual machine, a physical one, or a cloud sample. Every node present in a cluster should meet the configuration specifications to run a pod on the node. Two prime services such as kubelet and proxy services along with Docker were needed to establish interface and communication with the nodes which run the Docker containers present in the pod which was created on the node. Minions were not actually formed by Kubernetes but could be formed by a cluster manager present in virtual or physical machines or by a service provider for a cloud.
Q51) What do you mean by Node Controller?
Node controller is the group of services that were running in the Kubernetes Master. Node controllers are responsible to observe the activities of the nodes present on a cluster. They do this as per the identity of the metadata name assigned to a node. Node controller checks for the validity of a node. If the node is found valid, it assigns a freshly created pod to the valid node. If the node is invalid, the node controller will wait till the node becomes valid so as to assign a pod.
Q52) Tell me about Google container Engine.
Google Container Engine is available open-source and is a Kubernetes-based Engine that supports clusters that can run within the public cloud services of Google. This engine services as a platform for Docker containers and clusters.
Q53)What do you mean by Ingress network?
Ingress network provides a set of rules to enter into the Kubernetes cluster. This network is responsible to provide the incoming connections further This allows inbound connections, further configured according to the required specifications so as to offer to give services through URLs that are available externally, through load balance traffic, or by providing virtual hosting which is name-based. Therefore, an Ingress network can be defined as an API object that controls and administers external access to the services present in a cluster, through HTTP.
Q54) What do you know about Kubernetes Service?
Kubernetes service is defined as analytical pairs of pods. As per the information present on top of the pod, it will contain a DNS name and one IP address through which pods can be accessed. Kubernetes service is very useful to regulate and administer load balancing as per specific requirements. Kubernetes service also supports pods in scaling them too easily.
Q55) What are the types of Kubernetes services?
The following are the types of Kubernetes services:
Node port: Node port helps to fetch the details of a static port of the node deployed currently. With the assistance of Cluster IP, Node port routing can be established automatically. User can access this node port service away from the cluster through the following command:
ClusterIP: Cluster IP is responsible to fetch the information present in a Kubernetes cluster. It also aids in limiting the service within a cluster.
Load balancing: Load balancing is an important service available in Kubernetes to automatically balance the load in case of traffic. The above two services such as NodePort and ClusterIP were automatically created with which they help the external load balancer to do routing.
External Name: Maps the service to the contents of the External Name field by returning a CNAME record with its value. No proxying of any kind is set up.
Q56) What are the functions of Replication controller?
The following are the main functions of the replication controller:
It is responsible to control and administer the lifecycle of the pod.
It is responsible to monitor and verify whether the allowed number of pod replicas were running
It helps the user to check the running status of the pod
The replication controller lets the user alter a particular pod. The user can drag its position to the top or to the bottom.
Q57) What do you know about the Replica set?
A replica set is considered as a substitute for the replication controller. The prime function of the replica set is to assure the number of pod replicas running. There are two types of Label selectors supported by Kubernetes API. They are Equality-based selectors and Set-based selectors. The primary difference between the replication controller and replica set is that the replication controller supports equality-based selector alone whereas the replica set allows both types of selectors.
Q58) How do you update, delete and rollback in a Deployment strategy?
Update: Through this feature, the user could be able to update the existing deployment during runtime and before its completion. Through the update, the ongoing deployment will end and a fresh deployment will be created.
Delete: Through this feature, the user could be able to cancel or pause the ongoing deployment by deleting the deployment before its completion. Creating a similar deployment will resume the deployment.
Rollback: The user can restore a database or program to a previously defined state. This process is called Rollback. The user could be able to rollback the ongoing deployment through this feature.
Q59) What do you mean by “Recreate” and “Rolling Update” in the Deployment strategy?
With the aid of Deployment strategies, the user could be able to replace the existing replication controller with a new replication controller. Recreate is used to kill all the running (existing) replication controllers and creates newer replication controllers. Recreate helps the user in faster deployment whereas it increases the downtime if in case the new pods haven’t replaced the down old pods.
The rolling update also helps the user to replace the existing replica controller with newer ones. But, the deployment time is slow and in fact, we could say, there is no deployment at all. Here, some old pods and some new pods were readily available to the user to process at any time.
Q60) Write a command to create and fetch the deployment:
To create: kubectl create –f Deployment.yaml –record
To fetch: kubectl get deployments
Q61) Write a command to check the status of the deployment and to update a deployment.
To check the status: kubectl rollout status deployment/Deployment
To update a deployment: kubectl setimage deployment/Deployment tomcat = tomcat:6.0
Q62) What do you mean by volumes? What are the differences between Docker volumes and Kubernetes Volumes?
Volumes can be considered as directories through which the containers in a pod can be accessed. The differences between Kubernetes volumes and Docker volumes are:
|Kubernetes Volumes||Docker Volumes|
|Volumes are not limited to any particular container||Volumes are limited to a particular pod in a container|
|It supports all or any of the container deployed in a pod of Kubernetes||Does not support all container deployed in Docker|
|Supports many types of storage on the pod and also supports multiple storages at the same time||No such support in Docker|
Q63) List the Kubernetes volume you are aware of.
The following are some of the Kubernetes volumes which are widely used:
NFS: Network File System lets an ongoing NFS let you mount on your pod. Though you remove the pod from the node, the NFS volume will not be erased but only the volume is unmounted.
Flocker: Flocker is available open-source and is used to control and administer data volumes. It is a manager for data volume for a clustered container. Through Flocker volume, the user can create a Flocker dataset and mount the same to the pod. If in case, there is no such dataset available in Flocker, the user has to create the same through Flocker API.
EmptyDIR: Once a pod is assigned to a node, EmptyDIR is created. This volume stays active till the pod is alive and running on that particular node. EmptyDIR volume does not contain anything in the initial state and is empty; the user can read or write files from this volume. The data present in the volume gets erased once the pod is removed from that particular node.
AWS Elastic Block Store: This volume mounts Amazon Web Services Elastic Block Store onto your pod. Though you remove the pod from the node, data in the volume remains.
GCE Persistent Disk: This volume mounts Google Compute Engine Persistent Disk onto your pod. Similar to AWS Elastic Block Store, the data in the volume remains even after removing the pod from the node.
Host path: The host path mounts a directory or file from the file system of the host onto your pod.
RBD: Rados Block Device volume lets a Rados Block device be mounted onto your pod. Similar to AWS Elastic Block store and GCE Persistent Disk Volumes, even after removing the pod from the node, the data in the volume remaining.
Q64) What do you mean by Persistent Volume?
Persistent Volume is a network storage unit controlled by the administrator. PV is a strategy used to control an individual pod present in a cluster.
Q65) What do you mean by Persistent Volume Claim?
Persistent Volume Claim is actually the storage provided to the pods in Kubernetes after the request from Kubernetes. User is not expected to have knowledge in the provisioning and the claims has to be created where the pod is created and in the same namespace.
Q66) Define Secrets in Kubernetes.
As the name implies, secrets are sensitive information and in this context, they are login credentials of the user. Secrets are objects in Kubernetes which stores sensitive information namely the user name and the passwords after encrypting them.
Q67) How do you create secrets in Kubernetes?
Secrets can be created in various ways in Kubernetes. Some of them are
Through Text (txt) files
Through Yaml File
To create secrets from these files, user has to create username and password using kubectl command. The secret file has to be saved in the corresponding file format.
Q68) Explain the Network Policy in Kubernetes.
Network policy contains a set of protocol to achieve information transfer between the pods and defines how those pods present in the same name space transfers information with one another. It also defines data transfer with the network endpoint. User has to enable the network policy in the API server while configuring it in run time. Through the resources available in the network policy, select pods using labels and set the rules to permit the data traffic to a particular pod.
Q69) What will happen while adding new API to Kubernetes?
If you add a fresh API to Kubernetes, the same will provide extra features to Kubernetes. So, adding a new API will improve the functioning ability of Kubernetes. But, this will increase the cost and maintenance of the entire system. So, there is a need to maintain the cost and complexity of the system. This can be achieved by defining some sets for the new API.
Q70) How do you make changes in the API?
Changes in the API server has to be done by the team members of Kubernetes. They are responsible to add a new API without affecting the functions in the existing system.
Q71) What are the API versions available? Explain.
Kubernetes supports several versions of API in order to provide support to multiple structures. Versioning is available at Alpha level, Beta level and Stable level. All these version features are in multiple standards.
Alpha level versions have alpha values. This version is prone to errors but the user can drop for support to rectify errors at any time. But, this version is limited to test in a short time alone.
Beta level versions contain beta values. Scripts present in this version will be firm because they are completely tested. Users can look for support at any time in case of any errors. This version is not recommended to use in commercial applications.
Stable level versions get many updates often. User has to get the recent version. Generally, the version name will be vX, where ‘v’ refers to the version and ‘x’ refers to an integer.
Q72) Explain Kubectl command.
Kubectl commands provides an interface to establish communication between pods. They are also used to control and administer the pods present in the Kubernetes cluster. To communicate with the Kubernetes cluster, user has to declare kubectl command locally. These commands are also used to communicate and control the cluster and the Kubernetes objects.
Q73) What are the kubectl commands you are aware of?
- kubectl apply
- kubectl annotate
- kubectl attach
- kubectl api-versions
- kubectl autoscale
- kubectl config
- kubectl cluster-info
- kubectl cluster-info dump
- kubectl set cluster
- kubectl get clusters
- kubectl set-credentials
Q74) Using create command along with kubectl, what are the things possible?
Users can create several things using the create command with kubectl. They are:
- Creating namespace
- Creating deployment
- Creating secrets
- Creating secret generic
- Creating secret docker-registry
- Creating quota
- Creating service account
- Creating node port
- Creating load balancer
- Creating Cluster IP
Q75) What is kubectl drain?
kubectl drain command is used to drain a specific node during maintenance. Once this command is given, the node goes for maintenance and is made unavailable to any user. This is done to avoid assigning this node to a new container. The node will be made available once it completes maintenance.
Q76) How do you create an application in Kubernetes?
Creating an application in Kubernetes requires creating an application in Docker since Docker is essential for Kubernetes to perform its operation smoothly. Users can do any of the following two things to install Docker: can download or do the installation using the Docker file. Since Docker is available open-source, the existing image from the Docker hub can be downloaded and the same has to be stored in a local Docker registry.
To create a new application using the Docker file, the user has to create a Docker file initially. Once creating an image, the same can be transferred to the container after testing it completely.
Q77) What do you mean by application deployment in Kubernetes?
Deployment is the process of transferring images to the container and assigning the images to pods present in the Kubernetes cluster. Application deployment automatically sets up the application cluster thereby setting the pod, replication controller, replica set, and the deployment of service. Cluster setup is organized properly so as to ensure proper communication between the pods. This setup also sets up a load balancer to divert traffic between pods. Pods exchange information between one another through objects in Kubernetes.
Q78) Define Autoscaling in Kubernetes.
One of the important features of Kubernetes is Autoscaling. Autoscaling can be defined as scaling the nodes according to the demand for service response. Through this feature, the cluster increases the number of nodes as per the service response demand and decreases the nodes in case of the decrease in service response requirement. This feature is supported currently in Google Container Engine and Google Cloud Engine and AWS is expected to provide this feature at the earliest.
Q79) How will you do monitoring in Kubernetes?
To manage larger clusters, monitoring is needed. Monitoring is yet another important support in Kubernetes. To do monitoring, we have several tools. Monitoring through Prometheus is a famous and widely used tool. This tool not monitors, but also comes with an alert system. It is available as open-source. Prometheus is developed at Sound Cloud. This method has the capability to handle multi-dimensional data more accurately than other methods. Prometheus needs some more components to do the monitoring. They are
- Promotheus node explore
- Infux DB
- Prom ranch exporter
Q80) What is Kubernetes Log?
Kubernetes container logs are much similar to Docker container logs. But, Kubernetes allows users to view logs of deployed pods i.e running pods. Through the following functions in Kubernetes, we can get even specific information as well.
- Container name of Kubernetes
- Pod name of Kubernetes
- Name space of Kubernetes
- Kubernetes UID and
- Docker image name
Q81) What do you know about Sematext Docker Agent?
Sematext Docker Agent is more famous among the recent day developers. It is a log collection agent with metrics and events. Sematext Docker agent runs as a small container in each Docker host and gathers metrics, events and logs for all the containers and cluster nodes. If core services are deployed in Docker containers,it observes every container inclusive of a container for Kubernetes core services.
Q82) 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.
Q83) 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.
Q84) 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.
Q85) What do you understand by the Cloud controller manager?
The Cloud Controller Manager is responsible for persistent storage, network routing, abstracting the cloud-specific code from the core Kubernetes specific code, and managing the communication with the underlying cloud services. It might be split out into several different containers depending on which cloud platform you are running on and then it enables the cloud vendors and Kubernetes code to be developed without any inter-dependency. So, the cloud vendor develops their code and connects with the Kubernetes cloud-controller-manager while running the Kubernetes.
The various types of cloud controller manager are as follows:
1) Node controller: It checks and confirms that the node is deleted properly after it has been stopped.
2) Route controller: The route controller manages the traffic routes in the underlying cloud infrastructure.
3) Volume Controller: Manages the storage volume and interacts with the cloud provider to orchestrate volume.
4) Service Controller: The service controller responsible for the management of cloud provides load balancers.
Q86) What is Container resource monitoring?
As for users, it is really important to understand the performance of the application and resource utilization at all the different abstraction layers, Kubernetes factored the management of the cluster by creating abstraction at different levels like container, pods, services, and whole cluster. Now, each level can be monitored and this is nothing but Container resource monitoring.
The various container resource monitoring tools are as follows:
Heapster: Gathers data and events from the containers and pods within the cluster.
InfluxDB: sed along with Heapster for visualizing data within the Kubernetes environment.
Grafana: A time-series database to store the data captured by all Heapster pods.
CAdvisor: A built-in tool in a kubelet that automatically discovers all the active containers and monitors them.
Prometheus: A project of CNCF which provides powerful querying, alerting, and visualization capabilities.
Q87) 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.
Q88) What is a Headless Service?
Headless Service is similar to that of a ‘Normal’ services but does not have a Cluster IP. This service enables you to directly reach the pods without the need of accessing it through a proxy.
Q89) What are federated clusters?
Multiple Kubernetes clusters can be managed as a single cluster with the help of federated clusters. So, you can create multiple Kubernetes clusters within a data center/cloud and use federation to control/manage them all at one place.
The federated clusters can achieve this by doing the following two things.
Sync resources across clusters: Keeps the resource sync across multiple clusters to deploy the same deployment set across multiple clusters.
Cross cluster discovery : Provides the ability to have DNS and Load Balancer with backend from all the participating clusters.
Q90) Suppose a company built on monolithic architecture handles numerous products. Now, as the company expands in today’s scaling industry, their monolithic architecture started causing problems.
How do you think the company shifted from monolithic to microservices and deploy their services containers?
As the company’s goal is to shift from their monolithic application to microservices, they can end up building piece by piece, in parallel and just switch configurations in the background. Then they can put each of these built-in microservices on the Kubernetes platform. So, they can start by migrating their services once or twice and monitor them to make sure everything is running stable. Once they feel everything is going good, then they can migrate the rest of the application into their Kubernetes cluster.
Q91) Suppose a company wants to run various workloads on different cloud infrastructure from bare metal to a public cloud. How will the company achieve this in the presence of different interfaces?
Solution: The company can decompose its infrastructure into microservices and then adopt Kubernetes. This will let the company run various workloads on different cloud infrastructures.
Q92) What are the means by which Kubernetes simplifies containerized Deployment?
If you can think about a typical application, it would essentially be a cluster of containers running across different hosts. These containers would need to communicate with each other. 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.
Q93) 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.
Q94) What are the services that a node gives and their responsibilities?
The services that include in a node is as follows:
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.
Q95) What are the main components of the master node?
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.
Q96) What are the different types of multiple-container pods?
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.
Q97) Mention different kinds of Namespaces in Kubernetes?
The namespaces are of three kinds. They are:
- Default: The default namespace that when the cluster comes out of the box with no other namespaces
- 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.
Q98) Mention the difference between Kubernetes and a docker?
|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|
Q99) What are the tools of container orchestration?
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
Q100) Mention the list of objects of Kubernetes?
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
Q101) What are the major operations of Kubelet as a node service component in Kubernetes?
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
Q102) What is the difference between the pod and the container?
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.
Q103) Explain Stateful sets in Kubernetes?
A stateful set is a workload API object used to manage the stateful application. It is used to manage 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.
Q104) How to determine the status of deployment?
To determine the status of the deployment, use the command below:
kubectl rollout status
If the output runs, then the deployment is successfully completed.
Q105) What is the role of clusters in Kubernetes?
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
Q106) What is the Cluster IP?
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.
Q107) What are the types of controller managers?
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
Q108) What are the main components of Kubernetes architecture?
The two main components of the Kubernetes architecture are as follows:
- Master node
- Worker node
Each node contains the individual components in it
Q109) Define Kube-api server?
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.
Q110) What are the disadvantages of Kubernetes?
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
Q111) Mention the types of controller managers
Types of controller managers are: 1) endpoints controller, 2) service accounts controller, 3) node controller, 4) namespace controller, 5) replication controller, 6) token controller.
Q112) Explain node port
The node port service is a fundamental way to get external traffic to your service. It opens a particular port on all nodes and forwards network traffic sent to this port.
Q113) What are the tools that are used for container monitoring?
Tools that are used for container monitoring are:
Q114) What are the important components of node status?
The important component of node status are:
Q115) List out some important Kubectl commands:
The important Kubectl commands are:
- kubectl annotate
- kubectl cluster-info
- kubectl attach
- kubectl apply
- kubectl config
- kubectl autoscale
- kubectl config current-context
- kubectl config set.
Q116) What do you mean by persistent volume?
A persistent volume is a storage unit that is controlled by the administrator. It is used to manage an individual pod in a cluster.
Q117) What is Sematext Docker Agent?
Sematext Docker agent is a log collection agent with events and metrics. It runs as a small container in each Docker host. These agents gather metrics, events, and logs for all cluster nodes and containers.
Q118) Define OpenShift
OpenShift is a public cloud application development and hosting platform developed by Red Hat. It offers automation for management so that developers can focus on writing the code.
Q119) Mention the difference between Docker volumes and Kubernetes Volumes
Volumes are not limited to any container.
Kubernetes volumes support all containers deployed in a pod of Kubernetes.
Volumes are limited to a pod in the container.
Docker volumes do not support all containers deployed in Docker.
Q120) What are the ways to provide API-Security on Kubernetes?
The ways to provide API-Security on Kubernetes are:
- 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
Q121) What is ContainerCreating pod?
A ContainerCreating pod is one that can be scheduled on a node but can’t start up properly.
Q122) What are the types of Kubernetes Volume?
The types of Kubernetes Volume are:
- GCE persistent disk
Q123) Explain PVC
The full form of 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.
Q124) What is the Kubernetes Network Policy?
Network Policy defines how the pods in the same namespace would communicate with each other and the network endpoint.
Q125) What is Kubernetes proxy service?
Kubernetes proxy service is a service that runs on the node and helps in making it available to an external host.
- Puppet Interview Questions And Answers
- Latest Weblogic Interview Questions and Answers
- Apache Kafka Interview Questions and answers
- Latest Docker Interview Question And Answer
- Apache Tomcat Interview Questions And Answers
- Microserverices Interview Questions And Answers
- Openshift Interview Question And Answers
- Splunk Interview Questions And Answers
- TOP 200+ JAVA Interview Questions And Answers
For more Interview Questions And Answers click here