Kubernetes interview questions 3
Q41) Once update is installed, add 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 etcd. 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 are working perfectly. For this purpose, Kubelets create logs and monitor the PodSpecs.
Q43) What do you know about Pods in Kubernetes?
Pods are actually contain a class of containers which 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 contain two kinds of Pods. They are:
Single Container Pod: 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:
k u b e c t l r u n < a b c d > i m a g e < x y z 1 2 3 4 > w h e r e
a b c d & . . n a m e o f t h e p o d
x y z 2 3 4 & . i m a g e n a m e o n t h e r e g i s t r y
Multicontainer pods: To create multicontainer 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 API server is to substantiate and configure the API objects which includes pods, associated services, controllers etc.,
There is no specific support to Kubernetes images as on 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 object 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 same labels, selectors are used in Kubernetes. Label Selectors are unique and users use it 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 to filter 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 runs the Docker containers present in the pod which were 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 are the group of services which 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 metadata name assigned to a node. Node controller checks for the validity of a node. If the node is found valid, it assigns a fresh created pod to the valid node. If the node is invalid, 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 which supports for clusters which 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 byIngress network?
Ingress network provides 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 give services through URLs which are available externally,through load balance traffic, or by providing virtual hosting which is name based. Therefore, Ingress network can be defines 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.
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.
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
Replication controller lets the user to alter a particular pod. The user can drag its position to the top or to the bottom.
Q57) What do you know about Replica set?
Replica set is considered as a substitute to the replication controller. The prime function of replica set is to assure the number of pod replicas running. There are two types of Label selectors supported by Kubernet API. They are: Equality based selectors and Set based selectors. The primary difference between the replication controller and replica set is that, replication controller supports equality based selector alone whereas the replica set allows both the types of selectors.
Update: Through this feature, user could be able to update the existing deployment during runtime and before its completion. Through 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 similar deployment will resume the deployment.
Rollback: User can restore a database or program to a previously defined state. This process is called as Rollback. User could be able to rollback the ongoing deployment through this feature.
Q 5 9 ) W h a t d o y o u m e a n b y R e c r e a t e a n d R o l l i n g U p d Deployment strategy?
With the aid of Deployment strategies, user could be able to replace the existing replication controller to 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
d e p l o y m e n t w h e r e a s i t i n c r e a s e s t h e d o w n t i m e , i f i n c a s e t h e n e w p o d s h old pods.
Rolling update also helps the user to replace the existing replica controller to 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 any time.
Q60) Write a command to create and fetch the deployment:
T o c r e a t e : k u b e c t l c r e a t e f D e p l o y m e n t . y a m l r e c o r d
To fetch: kubectl get deployments
Q61) Write a command to check the status of deploymentand to update a deployment.
To check the status: kubectl rollout status deployment/Deployment
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||Volumes are limited to a|
|particular container||particular pod in a container|
|It supports all or any of the||Does not support all container|
|container deployed in a pod of||deployed in Docker|
Supports many types of storage No such support in Docker
on the pod and also supports
multiple of storage at the same