You may have come across Kubernetes while dealing with deployment of your application or people referring you to use it for orchestration.
Basically, Kubernetes is an orchestration engine for managing containerized application workloads and services. Kubernetes is an open-source platform.
Key concepts of Kubernetes
Making use of Kubernetes requires understanding some of its key concepts such as pods, service, volumes, namespaces, and deployments.
Pod
Pod refers to one container or combination of more than one container which should be controlled as a single application. Pod contains application containers, storage and its resources, network Id and other configuration by which one can easily run single aspect/unit of an application.
Services
Service is what lets you communicate with your Kubernetes cluster. You have to feed or provide specific configuration to Kubernetes cluster service to run it in the infrastructure of Kubernetes. Services are responsible for scheduling the pods and also for taking care of how many pods are running in the environment.
Volumes
Volume in Kubernetes is the preferred mechanism for persisting data that is generated by Kubernetes pods. Kubernetes assures that data is preserved across container restarts. The volume will be removed only when pods is no more in existence or get destroyed.
Namespaces
Kubernetes supports multiple virtual clusters backed by the same physical cluster which are called namespaces. Namespaces are the way to divide or allocate cluster resources between multiple resources.
Deployments
Kubernetes deployments take care of services running on your cluster. The main purpose of it is to keep pods running and the creation of new pods accordingly, and making updates regarding to it. Replicas can only be managed with the help of deployment. They can’t be manipulated directly.
Why Kubernetes
Kubernetes is portable, extensible, and an open-source platform for managing containers.
Additionally, Kubernetes provides,
- Service discovery and load balancing
Kubernetes keeps you updated about what process is taking place at which container in pods. Suppose you are deploying your app and the load to any container reaches the max limit due to any reason, Kubernetes environment will let you transfer some amount of load to another container or will create or add a new one.
- Storage orchestration
Automatically mount the storage of your choice. Kubernetes lets you customise storage you’ll need in deployment of your application.
- Automated rollups and rollbacks
Kubernetes lets you schedule the use of containers. Suppose during the deployment of your app, you need type-a container for t time and after that you want to move load to type-b for t’ time. This can be done in Kubernetes. Same for rollbacks for destroying any container after using it at t’’ time. (Here t, t’ and t’’ are random time representing signs.)
- Automatic Bin packing
Same as storage orchestration but in bin packing, it can also let you define how much CPU and memory you need for any container. This makes Kubernetes more efficient by stopping ideal use of any resources and only providing the needed resources to any container.
- Self-Healing
As the name suggests, containers in Kubernetes can restart containers that fail, replace those, and reschedule containers. It can destroy the containers that are not responding according to the expectation of the user. Kubernetes doesn’t show the use of that container to users until containers are ready to serve again.
- Scaling
Kubernetes can analyze the logs of your application with a single command based on CPU usage to check whether it is working according to user desires or not. By using this feature of Kubernetes, one can identify the changes to be done in automated rollups and rollbacks.
What Kubernetes doesn’t do
- Kubernetes doesn’t limit the types of apps. Kubernetes wants variety of applications respect to loads, state and data processing workloads.
- Kubernetes is not a manager for managing your application flow, it's only an integration tool for your application.
- Kubernetes doesn’t provide self-healing systems.
- Kubernetes doesn’t work for orchestration; rather it eliminates the orchestration.
- In Kubernetes orchestration is “Execution of desired workflow”. Which means it completes the task-1 first you can’t go to task-2 until and unless you are done with task-1 successfully.
Let’s understand the requirements of Kubernetes with the help of a story.
Suppose a girl named Zeal designs an application named ‘Food Cart’ using containers and deploys it. The application becomes popular with time and users interacting with it increase. To keep it running, she needs to deal with thousands of containers. Zeal is worried about it.
At that time, one of her friends named Alexa helps her and tells her about Kubernetes. Kubernetes introduces Master node and multiple worker-nodes. Worker nodes handle the pods having containers inside.
Once Zeal is ready with definition, she tells Master node and schedules the workflow accordingly for the worker-nodes.
Now, Kubernetes is in charge. It takes care of all container rollups and rollbacks. With the help of Kubernetes now, Zeal can spend more time in the enhancement of the application rather than worrying about handling the complexity of container handling.