Saturday, May 22, 2021

Basics of Kubernetes

 




Problem with Scaling up the Container:
Containers : Its OS-level virtualization and containers consist of application with its required dependency, Binaries and configuration files.
It isolated from one another
It is lightweight, Reliable, Efficient, Light-weight & Scalable

Problem :

1. Not easily scalable
2. In case you are running your container on docker Host and unfortunately docker service stopped or by mistake we kill the container then entire application will become down.
3. Containers can not communicate with each other
4. Containers had to be deployed appropriately
5. Containers had to be managed carefully
6. Auto scaling is not possible
7. Distributed traffic was still challenge


A container Management Tool:
Kubernetes is an open-source Container Management tool or (Container orchestration solution) which automates container deployment, container scaling & container load balancing

- Written on Golang, it has a huge community because it was first develop by Google & later denoted to CNCF(i.e. Cloud native platform)
- Can group 'n' no of containers into one logical unit for managing & deploying them easily

Suppose - You have to run an application on one container and you have to make it scalable to make multiple containerization for this reason we use the container orchestration tool i.e. Kubernates

Also we can achieve the load balancing - Suppose one node got spin down in your cluster then automatically another node should get spin up. This can be done by Kubernates
Kubernates majorly used in deployments that is roll up and roll back - If you deployed application version as v1, v2, v3 and v1 but any point of time can roll back to version v1 using kubernetes


Feature :
Automatic bin packing: Kubernetes places containers automatically based on the required resources and other restrictions without impairing availability.
Health check and self-repair: Containers that fail are restarted automatically. If a node fails, the containers contained in the node are redistributed. If containers do not respond to the user-defined health check, Kubernetes automatically stops these containers. The open-source container cluster orchestration system also offers auto-placement, auto-replication and auto-scaling.
Automated rollouts and rollbacks: Kubernetes distributes changes to the software or the configuration using a rollout. The open-source container cluster orchestration system also monitors the application's status. If a problem occurs, the system automatically executes a rollback.
Service discovery and load balancing: Kubernetes gives containers their own IP addresses and a single DNS name for a set of containers, and can load-balance across them.
Batch execution: Kubernetes can manage job to run in background. we can run jobs parallel and sequentially. 
Secret and configuration management: we can fetch credentials/confidential data from third party tool hence no security harm. also Kubernates encode it in base64 


Myths about Kubernetes:
You should not compare kubernetes with Docker
-Docker is continuous solution
-Kubernetes is container orchestration solution
-Using docker we can create images then containers
-Using Kubernetes we can not create container
-Docker used to create images
-Kubernates used to containerized the images


Difference between Kubernetes vs Docker Swarm


Kubernetes Architecture:


A Kubernetes cluster consists of master and worker nodes. The master automatically orchestrates the cluster. It receives commands from the administrator and forwards them to the workers. Linux containers grouped into pods are run on the worker nodes.

Important Technical Terms 
Master: The master orchestrates the cluster.
Worker: These machines run the requested and assigned tasks via Linux containers that are grouped into pods.
Pod: A group consisting of one or more containers that are used on a single node. All containers in a pod share the same IP address, IPC, host name and other resources, for example shared storages. Each pod is linked to the node on which it is scheduled and remains there until it is stopped or deleted. Each pod also runs at least one Kubelet and one container runtime.
Kubelet: The Kubelet is an agent of the master. This process is run on each node and handles the communication between the master and the node. Kubelets make sure that the defined containers have been started and are running.
kubectl: kubectl is the command line interface for managing Kubernetes clusters.
Replication controller: A replication controller makes sure that a defined number of pod replicas are running at all times.






Horizontal and Vertical Scaling: 
Horizontal scaling means that you scale by adding more machines into your pool of resources whereas Vertical scaling means that you scale by adding more power (CPU, RAM) to an existing machine.

An easy way to remember this is to think of a machine on a server rack, we add more machines across the horizontal direction and add more resources to a machine in the vertical direction.


           Horizontal Scaling/Vertical Scaling Visualisation

No comments:

Post a Comment

How to install Java on EC2

***************************************** How to install Java on EC2 ***************************************** To be continued, In this post...

All Time Popular Post