Table of Contents
ToggleKubernetes Architecture
The open source system Kubernetes for controlling containers makes it easy to launch, grow, and handle containerized programs. It is made to be expandable, bendable, and easy to move around in DevOps. Kubernetes architecture consists of two main parts: the control plane and the worker nodes.
- The control plane schedules pods, manages resources, and provides a single API for cluster interaction.
- The worker nodes are the physical or virtual machines that run the containers.
The control plane and worker nodes communicate with each other using a distributed key-value store called etcd.
Note: In Unix, all the files (system files) are saved in the folder named /etc. And the “d” means disturbed. Hence the ETCD full form is “/etc disturbed”.
Kubernetes Concepts
Let’s first understand the terms we are going to use and their meanings. Kubernetes has many key ideas you must grasp to utilize it properly. These concepts include:
- Pods: A pod is a group of one or more containers that are scheduled to run on the same node. Pods are the basic unit of scheduling and management in Kubernetes.
- Services: A service is a logical abstraction of a pod or group of pods that provides a single point of access to the pods. Services are used to expose pods to the outside world and to load balance traffic between pods.
- Volumes: A volume is a persistent storage resource that can be attached to pods. Volumes are used to store data that needs to be persisted across pod restarts.
- Deployments: A deployment is a Kubernetes object that manages the deployment and scaling of pods. Deployments can be used to automatically roll out new versions of pods or to scale the number of pods running in a cluster.
- Namespaces: A namespace is a way to logically organize pods, services, and other Kubernetes resources.
What is Kubernetes in devops?
Kubernetes simplifies containerized app startup, control, and growth. It is a standard method for building & managing microservices.
Kubernetes provides a number of features that make it a powerful container orchestration system:-
- Scheduling:- Kubernetes can automatically schedule pods to run on worker nodes.
- Load balancing:- Kubernetes can automatically load balanced traffic across pods.
- Autoscaling:- Kubernetes can automatically scale up or down the number of pods running in a cluster based on demand.
- Health checks:– Kubernetes can monitor the health of pods and automatically restart them if they fail.
- Networking:- Kubernetes provides a network abstraction that makes it easy to connect pods to each other and to the outside world.
- Storage:- Kubernetes provides a variety of storage options for pods, including persistent volumes and temporary volumes.
What is the Kubernetes Architecture in DevOps?
Kubernetes architecture is divided into two main components: the control plane and the worker nodes.
The control plane is in charge of handling the cluster. This cluster has the folowing tasks
- organizing pods
- manage resources
- giving a unified API for dealing with the cluster
The control plane consists of the following components:-
Kubernetes API server
The API server is the (main) entry point for interacting with Kubernetes. Its RESTful API lets you use Kubernetes resources (pods, services, and others).
ETCD
etcd is a distributed key-value store that is used to store the cluster state. The control plane uses etcd to store information about pods, services, and other Kubernetes resources.
Kubernetes scheduler
The scheduler is responsible for scheduling pods to run on worker nodes. The scheduler takes into account the resources available on each node and the requirements of the pods when making scheduling decisions.
Kubernetes controller manager
The controller manager is responsible for managing the lifecycle of pods and other Kubernetes resources. The controller manager watches for changes to Kubernetes resources and takes action to ensure that the resources are in the desired state.
The worker nodes are the physical or virtual machines that run the containers. Worker nodes are responsible for running pods and providing resources to the pods. Worker nodes consist of the following components:
Container runtime engine
The container runtime engine is responsible for running the containers on the worker node. The most popular container runtime engine is Docker.
Kubelet
The kubelet is a process that runs on each worker node and is responsible for managing the pods running on the node. The kubelet communicates with the API server to get information about the pods that should be running on the node and then starts and stops the pods as needed.
Kube-proxy
The kube-proxy is a process that runs on each worker node and is responsible for providing network connectivity to the pods. The kube-proxy uses the iptables firewall to route traffic to the pods
Kubernetes Cluster Architecture
A Kubernetes cluster is a group of worker nodes that are managed by the control plane. A cluster can have just one node or more than one. The size & complexity of the application you are running will determine how many nodes you need in a cluster.
The following diagram shows the basic architecture of a Kubernetes cluster:-
Control Plane
The control plane is made up of the following components:-
- API server:- The API server is the main entry point for interacting with Kubernetes. It works just like explained previously.
- etcd: etcd is a distributed key-value store that is used to store the state of the cluster. The control plane uses etcd to store information about pods, services, and other Kubernetes resources.
- Kubernetes scheduler: The scheduler is responsible for scheduling pods to run on worker nodes. The scheduler takes into account the resources available on each node and the requirements of the pods when making scheduling decisions.
- Kubernetes controller manager:- The controller manager is responsible for managing the lifecycle of pods and other Kubernetes resources. The controller manager watches for changes to Kubernetes resources and takes action to ensure that the resources are in the desired state.
Worker Nodes
The worker nodes are the physical or virtual machines that run the containers. Worker nodes consist of the following components:
- Container runtime engine: The container runtime engine is responsible for running the containers on the worker node. The most popular container runtime engine is Docker.
- Kubelet: The kubelet is a process that runs on each worker node and is responsible for managing the pods running on the node. The kubelet communicates with the API server to get information about the pods that should be running on the node and then starts and stops the pods as needed.
- Kube-proxy: The kube-proxy is a process that runs on each worker node and is responsible for providing network connectivity to the pods. The kube-proxy uses the iptables firewall to route traffic to the pods.
Additional Kubernetes components
There are many other Kubernetes components in Kubernetes in addition to the core components:-
- Deployments: A deployment is a Kubernetes object that manages the deployment and scaling of pods. Deployments can be used to automatically roll out new versions of pods or to scale the number of pods running in a cluster.
- ReplicaSet: A replica set is a Kubernetes object that ensures that a specified number of pods are running at all times. ReplicaSet is used to ensure that the pods are always available, even if some of the pods fail.
- ClusterDNS:- ClusterDNS is a Kubernetes service that provides DNS (DNS full form: Domain Name System) resolution for pods in the cluster.
- Container Resource Monitoring: Container Resource Monitoring is a Kubernetes component that provides monitoring of the resources used by containers.
Add-on plugins for kubernetes
Enhancing Kubernetes with Add-On Plugins and Extensions:-
- CoreDNS: A New Dimension in DNS: CoreDNS replaces the traditional ClusterDNS, offering enhanced flexibility and scalability in DNS resolution within the Kubernetes cluster.
- KuberVirt: Bridging Virtualization and Containers: KuberVirt extends Kubernetes capabilities by enabling the execution of virtual machines. It’s a way for old apps to work with the new container environment.
- ACR: Streamlining Image Management: ACR (Azure Container Registry) is a managed container registry service that simplifies image storage and management, streamlining the deployment process.
- Calio: A User-Friendly Interface: Calio introduces a graphical user interface for Kubernetes management, simplifying cluster interaction and resource monitoring.
Commands for kubectl
Kubectl is the Kubernetes command line tool. The kubectl command line tool builds, changes, and removes Kubernetes pods, services, and other resources. Kubectl can help you learn about & repair Kubernetes tools.
The following are some of the most common kubectl commands:-
- kubectl create: Create a new Kubernetes resource.
- kubectl get: Get information about a Kubernetes resource.
- kubectl update: Update a Kubernetes resource.
- kubectl delete: Delete a Kubernetes resource.
- kubectl describe: Get information about a Kubernetes resource.
- kubectl logs: Get the logs for a pod.
Conclusion
- Powerful Container Orchestration: Kubernetes deploys, manages, scales containerized apps.
- Complex System: Well-documented with available learning resources.
- Resilient Applications: Enables building resilient, scalable, and efficient apps.
- Embrace Cloud-Native Future: Start journey today for cloud-native development with Kubernetes.
Also Read
- What is Docker in DevOps?
- How do Agile and DevOps interrelate?
- AWS DevOps interview questions
- DevOps Engineer Skills