What is Kubernetes?
Kubernetes is an open-source container orchestration framework that was originally developed by google so on the foundation, it manages containers. Be docker containers or from some other technology which basically means that Kubernetes helps you manage applications that are made up of hundreds or maybe thousands of containers and it helps you manage them in different environments like physical machines virtual machines or cloud environments or even hybrid deployment environments.
What problems does Kubernetes solve and what are the tasks of a container orchestration tool?
The rise of microservices cause increased usage of container technologies because the containers actually offer the perfect host for small independent applications like Microservices. And the rise of containers and microservice technology actually resulted in applications that they’re now comprised of hundreds or sometime maybe even thousands of containers. Now managing those loads of containers across multiple environments using scripts and self-made tools can be really complex and sometimes even impossible so that specific scenario actually caused the need for having container orchestration technologies. Below are points that Kubernetes Orchestration tools guarantee
- High availability(No Downtime): It means that the application has no downtime so it’s always accessible by the users.
- Scalability(High Performance): It means that the application has a high performance. It loads fast and users have very high response rates from the application
- Disaster Recovery(Backup & Recovery): It basically means that if infrastructure has some problems like data are lost or the servers explode or something bad happens with the server centre then the infrastructure has to have some kind of mechanism to pick up the data and to restore it to the latest state so that application doesn’t actually lose any data and the containerized application can run from the latest state after the recovery.
All of these are functionalities that container orchestration technologies like Kubernetes offer.
Kubernative Basic Architecture
Kubernetes cluster is made up of at least one master node and then connected to a couple of worker nodes Where each node has a Kubelet process running on it. Kubelet is actually a Kubernetes process that makes it possible for the cluster to talk to each other, to communicate to each other and actually execute some tasks on those nodes like running application processes. Each worker node has docker containers of different applications deployed on it.
So depending on how the workload is distributed you would have different numbers of Docker containers running on worker nodes and worker nodes are where the actual work is happening like application.
So the question is what is running on the master node?
Master node actually runs several Kubernetes processes that are absolutely necessary to run and manage the cluster properly one of such processes is an API server which also is a container. An API server is actually the entry point to the Kubernetes cluster so this is the process which the different Kubernetes clients will talk to like UI if you’re using Kubernetes dashboard.
If you’re using some scripts and automating technologies and a command-line tool so all of these will talk to the API server.
- API Server: Entry Point to Kubernetes Server
- Controller Manager(Keeps track of what is happening in the cluster): Basically keeps an overview of what’s happening in the cluster whether something needs to be repaired or maybe if a container died and it needs to be restarted.
- Scheduler(Ensure Pods Placement): Basically responsible for scheduling containers on different nodes based on the workload and the available server resources on each node so it’s an intelligent process that decides on which worker node the next container should be scheduled based on the available resources on those worker nodes.
- etcd(Kubernetes Backing Store): Basically holds at any time the current state of the Kubernetes cluster so it has all the configuration data inside and all the status data of each node and each container inside of that node and the backup and restore that we mentioned previously is actually made from these etcd snapshots because you can recover the whole cluster state using that etcd snapshot
- Virtual Network: It enables those worker nodes and master nodes to talk to each other. It creates one unified machine.
Kubernetes Basic Concepts
Pod: Pod is the smallest unit that you as a Kubernetes user will configure and interact. Pod is basically a wrapper of a container and on each worker node you’re gonna have multiple pods and inside of a Pod you can actually have multiple containers.
There is a virtual network that dispenses the kubernetes cluster so it assigns each pod its own IP address so each pod is its own self-containing server with its own IP address and the way that they can communicate with each other are by using that internal IP addresses.
If Pods die then a new IP address will be assigned and in that case, it will be very inconvenient. So instead of IP another component of Kubernetes is used i.e. Service is used. Service is an alternative for IP addresses. Now if Pods die then Service does not replace.
Service- Kubernetes Component Use
- Permanent IP address which can be used to communicate between pods.
- Load Balancer
Sample Template for Creating Pods
In the below screenshot, Kubernetes creates 2 replicas of pods with the label my-app and with container image my-image. It also set an environment variable and port configuration.
For Docker, you can visit our Docker Link.
If you love to read more such content then don’t forget to subscribe. If you want to visit more topic related then Please visit our Tech Category