Q What Are Pods In Kubernetes
Pods are the smallest deployable units of computing that you can create and manage in Kubernetes.
A Pod is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers. Containers in the same pod share a local network and the same resources, allowing them to easily communicate with other containers in the same pod as if they were on the same machine while at the same time maintaining a degree of isolation.
Example: The following is an example of a Pod which consists of a container running the image nginx:1.14.2.
# pods/simple-pod.yamlapiVersion: v1kind: Podmetadata:name: nginxspec:containers: - name: nginximage: nginx:1.14.2ports: - containerPort: 80
The Kubernetes Devops Tool
The container orchestration capability of Kubernetes closes the gap between IT operations and development, making a great collaborative DevOps environment for sharing software and their dependencies seamlessly between different environments.
It facilitates the software lifecycle and the enabler teams in the build-test-deploy timeline:
- Developer environment, by helping to run the software in any setting
- QA/Testing process, through coordinated pipelines between test and production
- Sys-admin, by running anything once configured
- Operations, by offering a comprehensive solution for building, shipping, and scaling software
Kubernetes has emerged as a good actor in DevOps as it focuses on features and bugs rather than time-intensive tasks to enable better software to be shipped with a smooth DevOps workflow.
What Do You Understand By The Term Orchestration When It Comes To Software And Devops
The term orchestration specifies integrating multiple services that allow them to automate processes or synchronize information in a specific time sequence.
For example, suppose we have six or seven microservices for an application to run, then if you place them in separate containers, this would inevitably create obstacles for communication. Using orchestration, we can do it quickly to enable all services in individual containers to work seamlessly to accomplish a single goal.
Don’t Miss: How To Setup A Podcast Interview
Q How Kubernetes Simplifies The Containerized Deployment
A cluster of containers of applications running across multiple hosts requires communications. To make the communication happen, we require something that can scale, balance, and monitor the containers. As Kubernetes is an anti-agnostic tool that can run on any public to a private provider, it is the best choice that can simplify the containerized deployment.
How To Troubleshoot If The Pod Is Not Getting Scheduled
![Kubernetes interview questions and answers Kubernetes interview questions and answers](https://www.interviewprotips.com/wp-content/uploads/kubernetes-interview-questions-and-answers.png)
In K8s scheduler is responsible to spawn pods into nodes. There are many factors that can lead to unstartable POD. The most common one is running out of resources, use the commands like kubectl describe < POD> -n < Namespace> to see the reason why POD is not started. Also, keep an eye on kubectl to get events to see all events coming from the cluster.
Read Also: Learn Data Structures And Algorithms For Interviews
Q20 Explain Replication Controllers
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.
Visit here to learn Kubernetes Online Course in Hyderabad |
Q35 What Are Federated Clusters
Ans- The Kubernetes clusters can be managed using federated clusters. The federated clusters achieve this by-
Cross-cluster discovery- This provides the ability to have DNS and LoadBalancer with backend from all participating clusters
Sync resource across clusters- Keeps the resource sync across multiple clusters to deploy set across multiple clusters.
You May Like: Inventory Interview Questions And Answers
Q1 What Are The Different Components Of Kubernetes Architecture
The Kubernetes Architecture has mainly 2 components the master node and the worker node. As you can see in the below diagram, the master and the worker nodes have many inbuilt components within them. The master node has the kube-controller-manager, kube-apiserver, kube-scheduler, etcd. Whereas the worker node has kubelet and kube-proxy running on each node.
Q What Are Kubernetes Services
A Kubernetes Service is an abstraction which defines a logical set of Pods running somewhere in your cluster, that all provide the same functionality. When created, each Service is assigned a unique IP address . This address is tied to the lifespan of the Service, and will not change while the Service is alive.
Pods can be configured to talk to the Service, and know that communication to the Service will be automatically load-balanced out to some pod that is a member of the Service.
Example:
apiVersion: v1kind: Servicemetadata:name: my-servicespec:selector:app: MyAppports: - protocol: TCPport: 80targetPort: 9376
This specification creates a new Service object named “my-service”, which targets TCP port 9376 on any Pod with the app=MyApp label.
You May Like: What Are The Most Popular Interview Questions
Q6 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 front end of the cluster and communicates with the cluster through the 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 the proper action for triggering events.
How Is Overlay Network Different From Bridge Network
Bridge networks connect two networks while creating a single aggregate network from multiple communication networks or network segments, hence the name bridge. Overlay networks are usually used to create a virtual network between two separate hosts. Virtual, since the network is build over an existing network. Bridge networks can cater to single host, while overlay networks are for multiple hosts.
- an overlay network called ingress, which handles control and data traffic related to swarm services. When you create a swarm service and do not connect it to a user-defined overlay network, it connects to the ingress network by default.
- a bridge network called docker_gwbridge, which connects the individual Docker daemon to the other daemons participating in the swarm.
Don’t Miss: How To Prepare For A Phone Job Interview
What Is The Kubernetes Controller Manager
View answer
Hide answer
Multiple controller processes run on the master node but are compiled together to run as a single process which is the Kubernetes Controller Manager. So, Controller Manager is a daemon that embeds controllers and does namespace creation and garbage collection. It owns the responsibility and communicates with the API server to manage the end-points.
What Are Node Components In Kubernetes
![Kubernetes Architecture in Kubernetes Tutorial 04 September 2020 ... Kubernetes Architecture in Kubernetes Tutorial 04 September 2020 ...](https://www.interviewprotips.com/wp-content/uploads/kubernetes-architecture-in-kubernetes-tutorial-04-september-2020.jpeg)
Node components run on each node where they manage pods and provide the runtime environment to Kubernetes. The following are the node components:
- Kubelet: Makes sure that the containers are running in a pod
- Kube-proxy: Maintains the desired network rules on nodes. These rules allow the network communication from sessions inside or outside of your Kubernetes cluster to your pods.
- Container runtime: This software runs containers. Kubernetes supports various container runtimes, such as Containerd, CRI-O, Docker, or any Kubernetes Container Runtime Interface implementation.
Don’t Miss: Accounts Payable Analyst Interview Questions
Q32 What Is The Role Of The Kube
Ans- The Kube API server follows the scale-out architecture, it is the front-end of the control panel. It exposes all the API of the Kubernetes master node components and is responsible for communication between the nodes and master components.
The Kube-scheduler is responsible for the distribution and management of the workload of the worker nodes. It selects the most suitable node to run the unscheduled pod based on resource requirement and utilization.
What Is A Cluster Of Containers In Kubernetes
A Kubernetes cluster is a set of nodes that run containerized applications. Containerizing applications package an app with its dependencies and some necessary services. Kubernetes clusters allow containers to run across multiple machines and environments: virtual, physical, cloud-based, and on-premises.
Also Check: What Questions Do You Get Asked In A Job Interview
How Can One Create Macvlan Network For Docker Container
To create a Macvlan network which bridges with a given physical network interface, once can use driver macvlan with the docker network create command. You also need to specify the parent, which is the interface the traffic will physically go through on the Docker host.
$ docker network create -d macvlan \ --subnet=172.16.86.0/24 \ --gateway=172.16.86.1 \ -o parent=eth0 collabnet
What Are Control Plane Components
These components are responsible for making the global decisions that will affect the cluster, responding to the cluster events such as starting a new pod. Below are some components.
- Kube-apiserver: Acts as the front end of the control plane
- Etcd: Consistent key-value store that stores all the data of the Kubernetes
- Kube-scheduler: Looks for newly created pods having no assigned nodes and chooses the desired nodes for them to run on with the right available resources
- Kube-controller-manager: Runs the controller process, including the node controllers, endpoints controllers, replication controllers, service accounts, and token controllers
- Cloud-controller-manager: Links your cluster into your cloud provider’s API. It will separate the components interacting with the cloud platform from those that only interact with your cluster.
Recommended Reading: How To Prepare For An Online Interview
What Are Main Difference Between Swarm & Kubernetes
Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It was built by Google based on their experience running containers in production using an internal cluster management system called Borg . In the other hand, a Swarm cluster consists of Docker Engine deployed on multiple nodes. Manager nodes perform orchestration and cluster management. Worker nodes receive and execute tasks Below are the major list of differences between Docker Swarm & Kubernetes:
Applications are deployed in the form of services in a Swarm cluster. Docker Compose is a tool which is majorly used to deploy the app. Applications are deployed in the form of a combination of pods, deployments, and services . Autoscaling feature is not available either in Docker Swarm or Docker Swarm Auto-scaling feature is available under K8s. It uses a simple number-of-pods target which is defined declaratively using deployments. CPU-utilization-per-pod target is available.
Docker Swarm health checks are limited to services. If a container backing the service does not come up , a new container is kicked off. Users can embed health check functionality into their Docker images using the HEALTHCHECK instruction. Under K8s, the health checks are of two kinds: liveness and readiness Out-of-the-box K8S provides a basic logging mechanism to pull aggregate logs for a set of containers that make up a pod.
Q How To Monitor The Kubernetes Cluster
Prometheus is used for Kubernetes cluster monitoring. The Prometheus ecosystem consists of multiple components.
- Mainly Prometheus server which scrapes and stores time-series data.
- Client libraries for instrumenting application code.
- Push gateway for supporting short-lived jobs.
- Special-purpose exporters for services like StatsD, HAProxy, Graphite, etc.
- An alert manager to handle alerts on various support tools.
Also Check: Grokking The Object Oriented Interview
Q How To Create And Use Configmap With Kubernetes
A Kubernetes ConfigMap is an API object that allows you to store data as key-value pairs. Kubernetes pods can use ConfigMaps as configuration files, environment variables or command-line arguments.
ConfigMaps allow you to decouple environment-specific configurations from containers to make applications portable. However, they are not suitable for confidential data storage.
Create a ConfigMap:
kubectl create configmap < map-name> < data-source>
where < map-name> is the name you want to assign to the ConfigMap and < data-source> is the directory, file, or literal value to draw the data from. The name of a ConfigMap object must be a valid DNS subdomain name.
Is Routing Mesh A Load Balancer
![even_driven_microservices_springboot_springcloud_kubernetes_docker_helm ... even_driven_microservices_springboot_springcloud_kubernetes_docker_helm ...](https://www.interviewprotips.com/wp-content/uploads/even_driven_microservices_springboot_springcloud_kubernetes_docker_helm.png)
Routing Mesh is not Load-Balancer. It makes use of LB concepts.It provides global publish port for a given service. The routing mesh uses port based service discovery and load balancing. So to reach any service from outside the cluster you need to expose ports and reach them via the Published Port. In simple words, if you had 3 swarm nodes, A, B and C, and a service which is running on nodes A and C and assigned node port 30000, this would be accessible via any of the 3 swarm nodes on port 30000 regardless of whether the service is running on that machine and automatically load balanced between the 2 running containers. I will talk about Routing Mesh in separate blog if time permits.
Recommended Reading: What Is Asked In An Exit Interview
Question 3 What Is Virtualization
Answer. Virtualization is a process that is used to create the virtual, software-based version of things, be it servers, computer storage, applications, etc. all these virtual environments or versions are being created from on physical hardware system.
One system is split into multiple sections that act like separate individual systems. This splitting is possible due to Hypervisor and the virtual environment that is created by using hypervisor is known as Virtual Machine.
Q3 Can You Brief On The Working Of The Master Node In Kubernetes
Kubernetes master controls the nodes and inside the nodes the containers are present. Now, these individual containers are contained inside pods and inside each pod, you can have a various number of containers based upon the configuration and requirements. So, if the pods have to be deployed, then they can either be deployed using user interface or command-line interface. Then, these pods are scheduled on the nodes, and based on the resource requirements, the pods are allocated to these nodes. The kube-apiserver makes sure that there is communication established between the Kubernetes node and the master components.
Also Check: How To Interview For A Nursing Job
What Is Orchestration In Software Development And Devops
Orchestration is the integration of multiple services to allow them to automate processes and synchronize information quickly. For example, lets say you have six to seven microservices that an application needs. You could create communication problems if you placed them in different containers. Orchestration can help with this situation. It allows all services to work together seamlessly to achieve a single goal.
Q8 What Are The Different Types Of Multiple
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 the 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, and 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.
Also Check: Employee Engagement Interview Questions And Answers
The Worker Node Consists Of Following Components:
a) Kubelet: This is the main component of worker node, responsible for actual orchestration of the containers. It interfaces with both Node and the Containers, and assigns the necessary resources and converts the complex yaml files to actual pods with applications running on top of it.
b) Kube-Proxy: To communicate with different Pods, an abstraction called Service is used. To implement Services, it is Kube-Proxy which is responsible for routing traffic to the appropriate Pod based on IP and port number of the incoming request. It also has intelligent routing, meaning it forwards to the appropriate replica to lower network overhead.
c) Container-Runtime: This is the implementation of Container software that is responsible for running the containers. Think of it as the software driver, that enables creation of containers.
Q13 Why Do We Need Container Orchestration In Kubernetes
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 of running time
- Scaling becomes easy
- It is used to deploy and manage complex containerized applications
- Reduces manual setting up services
Also Check: Interview Questions For Financial Planner
What Is Kubernetes Used For
Kubernetes is used for the automation of the manual operations that are involved in the deployment, management, and scaling of containerized applications. It keeps track of the ones that are deployed into the cloud, restarts orphaned ones, shuts down the unused, and automatically provides resources such as storage, memory, and CPU when required.
Q15 What Are Federated Clusters
![DevOpsChat Articles DevOpsChat Articles](https://www.interviewprotips.com/wp-content/uploads/devopschat-articles-kubernetes-a-explained-by-n00b-in-tech-sales.png)
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. Refer to the below diagram.
Don’t Miss: How To Prepare For Amazon Sde Interview
What Are The Different Types Of Hypervisors
Native Hypervisor: This type is also called a Bare-metal Hypervisor and runs directly on the underlying host system which also ensures direct access to the host hardware which is why it does not require base OS.
Hosted Hypervisor: This type makes use of the underlying host operating system which has the existing OS installed.
Q What Is A Node In Kubernetes
A node is the smallest fundamental unit of computing hardware. It represents a single machine in a cluster, which could be a physical machine in a data center or a virtual machine from a cloud provider. Each machine can substitute any other machine in a Kubernetes cluster. The master in Kubernetes controls the nodes that have containers.
You May Like: How To Say Thank You For The Interview