Introduction to Kubernetes
Kubernetes is a system that automates deployment, escalation, and management of containerized applications.
First, we will see why we need containers. A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably. We can generate containers using software like Docker, containerd.io, and Podman. The container provider software runs the containers and provides a container runtime environment (CRI).
As an example consider a harbour, there are many types of goods like foods, vehicles, and oils, etc. There are specific carrying methods for each good (oil store in a barrel, foods store in specific casings like that). But in the harbour for transferring all types of goods has one way that is container box. Any kind of good transfer via this container box. In the software world, it is also like this. When software automating, Container uses to store and run the software. By using a container, we can build a unique runtime environment. As an example node program cannot run a Java-compatible environment. So that containerization is very important in Kubernetes also. Let see it.
What is Kubernetes? Kubernetes is a production-grade container orchestration system that is an open-source system for automating deployment, scaling, and management of containerized applications.
After deploying applications in containers. It should maintain and keep up to date. When an increasing number of containers maintaining is very difficult to do. Not only, but it should also manually monitor whether containers are always running or not. Because if a container is not running, the services will be down. So that to overcome this problem need a container orchestration system. To overcome this problem Kubernetes comes as an orchestration platform in 2014. After deploying those instances of the cluster will be managed by Kubernetes and we do not need to do anything manually.
Kubernetes know what are the qualities of the production system.
- Extend the container goodness across nodes — Schedule containers to multiple nodes for high availability and it shares the network among containers.
- Recovers automatically from failure — If happen any crash in a container and go down, Kubernetes automatically restart that container and maintain the system’s durability. By default, Kubernetes has monitoring, logging, and health settings. According to our system, we can extend these services.
- Enables containers to find each other — When there exist multiple services there should be communication among them. So that Kubernetes by default provides related networking or service layer.
- Reduce cost to run many things in production — It enables new ways of building applications. Kubernetes provide convenience to run multiple software applications on the same server. So that it increases productivity.
Self Healing (Reconciliation Loop)
This is the heart of the Kubernetes and this loop is called as reconciliation loop. Simply, reconciliation is maintaining the desired state. In the development desired state we defined in our deployment YAML file. In that YAML file, we can configure what type of environment the application should have. According to the reconciliation loop, it maps the current state and desired state configured in the YAML file.
What can Kubernetes really do?
- Autoscale workloads — In here we can select what kind of situation should increase or decrease the number of containers that running. We can select situation CPU based, memory base and according to customers metrics(like the number of requests that come) like that. When increasing value based on a particular factor Kubernetes will increase the number of containers.
- Manage Stateless and Stateful application — as an example if we consider microservice system is stateless. Stateless apps can restart because there is no cache. But think of a situation like a database, it is stateful and there is previous data also so that it cannot restart because of the data loss. So Kubernetes support stateless and stateful applications.
- Deployments — by default Kubernetes support rolling deployment(Roll forward / Rollbacks). Rolling deployment is deployed a new version without any cluster disruption. As an example when the current software version is v2.0 and the new version is v2.1, we apply v2.1 to the Kubernetes cluster. Kubernetes cluster will apply the new version step by step and not completely down the v2.0 and apply the v2.1. This is the rolling deployment and there is no downtime.
- Provide native methods of service discovery — when considering microservice applications there is a service registry and service discovery concept. Most probably it is bound with an application built-in programming language. Think we have a microservice that writes in a different language. When integrating microservices there are some difficulties because the microservice that writes with different language integrate is not easy. For that problem, Kubernetes provides a service discovery solution that independent of written language.
- Easily integrate and support 3rd party apps — although we change the deploying platform, always we use containers. There are some standards to write containerize applications. Because of these standard specifications, the mechanism is the same everywhere. When doing software multiple deployments same files and the same spec can be used across different cloud providers and on-premise data centers as well.
I hope it is was helpful. Happy Developing🎉🎈…