Total Blog Views: 54
Blog Status: publish
Created By: apoorva Created at: 08-12-2021
Tags: kubernetes Devops
Kubernetes is open-source orchestration software for deploying, managing, and scaling containers. Originally designed by Google and is now maintained by the Cloud Native Computing Foundation. Kubernetes is a Container management tool.
As applications scales up multiple containers are deployed across multiple servers, operating them becomes complex.To handle this complexity, Kubernetes provides an open source API that controls how and where those containers will run.Kubernetes orchestrates clusters of virtual machines and schedules containers to run on those virtual machines based on their available compute resources and the resource requirements of each container. Containers are grouped into pods, the basic operational unit for Kubernetes, and those pods scale to your desired state.Kubernetes also automatically manages service discovery, incorporates load balancing, tracks resource allocation, and scales based on compute utilization. And, it checks the health of individual resources and enables apps to self-heal by automatically restarting or replicating containers.
Running containerised application would be complex because they are often deployed across different machines.You need your app services to run fine without being down at any point of time even where there are larger number of users fetching the same endpoint at given instant of time. Kubernetes provides a way to schedule and deploy these containers and also helps you to scale it to desired state.Use Kubernetes to implement your container-based applications in a portable, scalable, and extensible way.
Once when you deploy kubernetes you get a cluster .Cluster contains of nodes.Nodes are set of machines.Each node consist of atlest one master and a worker node. There may more than one master and worker nodes based on CPU utilization.There many be many number of clusters in kubernetes.
Number of pods,containers that a cluster can have :
A cluster can have no more than - 5000 nodes
No more than 150000 pods
No more than 300000 containers
No more than 100 pods per node.
Master Node
Master node consist of components:
1) API Server:
It deals with all communications.An API sever has exposed APIs for every operation, throught which we can communicate.We can communicate with API server using the command line (kubectl cmd) or through dashboard (UI).
2) Scheduler:
Scheduler gets all the information from the configuration file and storage etcd then schedule the job to the best fit node and pods (selects the node to run the task).Keeps track of newly created nodes and collects hardware data and memory data from config file and etcd.
3) Control Manager:
Its a component of master that runs the controllers. Each control is a separate process but they are combines into single binary and all the process are run.The control manager is responsible for monitoring the overall health of the cluster. Controllers run in clusters and compare the current state with the configuration any changes in it would be reported to the respective component. Mismatch corrective measure is taken until the current state matches the configuration file. Below we have control managers and the specific task they perform:
a) kube control manager: It ensures all the pods are running are running at the at same time.The required number of pods are running as er the manifeast file.
b) Node Controller: Responsible for monitering the nodes and signals if ant node is down.
c) Replication Controllers:Replication controllers are responsible for manitaining the correct number of pods, for every replication.
d) Endpoint Controllers:Populates the endpoints object.
e) Service account and token controllers:Creates default accounts and API access tokens for new namespaces.
f) Cloud control manager:You can disable the cloud controller loop by setting up the --cloud-provider flag when starting kube- controller-manager.
(i) Node Controller:For checking if the node has been deleted from the cloud provider after it has stopped responding.
(ii) Router Controller:If the routes in the colud intrastructure.
(iii) Service Controller:For creating,updating,deleting cloud provider load balancers.
(iV) Volume Controllers:For creating,mouting,attaching and interacting with coud providers to orchestrate volumes.
4) ETCD:
Its an open source distributed key value data source from CoreOS.It is consistanat and highly available key value data store used foe back storing of cluster data.
Note: Only the API server can communicate with the etcd.
ETCD Can be a part of kubernetes or it can be configured externally.
worker node
The worker nodes are either virtual machines or physical machines.
Every node in a kubernetes cluster must run a container runtime like docker.
components of a worker node:
1) Kublet:
Kublet is a component in a node. It ineracts with the master node in the via API servers.Kublet is present in every node to manage the containers running on the node created by Kubernetes. If any issues with the pods it either restart the pods or replaces the pods.
Note: The kubelet can only manage the containers created by the kubernetes.
2) Kube-proxy:
Kube-proxy is a agent that runs on each node reponsible for maintainig network configurations and rules. Exposes the services to the outside world.
Note: It observes the API server from the master node for the addition or deletion of the service endpoints.
3) Container Runtime:
The kubernetes is not responsible for running the containers and pods on its own. It needs a container run time environment to run the kubernetes containers.There are many run time environments available like docker,containerd,Cri-o,Rktlet,kuberetes CRI( Container Runtime Interface).
To run the containers and pods we use the docker runtime environment.
Kubernetes Features:
1) Automatic pin packing:
suppose say there are 5 servers each has memory of 10GB and resources has to be packed into these 5 servers and this done efficiently by kubernetes.
2) Service discovery and Loadbalancing:
When you specify a pod you can also optionally specify the memory and RAM each container. So when the container resource request is specified then its easy for the scheduler to decide on to which node to place the pod.Containers are packed into pods and each pod is given a unique IP address. In a node with multiple pods can have a same a service abstraction and the service is given a unique Domain Name Service (DNS), with this the kubernetes has control over the network communication and load balancing between the pods
3) Storage Orchestration:
Each pod has a storage volume to store the container data. Storing the container data is given optionally either locally/cloud(AWS), Network File system.
4) Self Healing:
All the nodes and containers has to respond to the health check by the kubernetes.
Replication control:
a)If a container fails --> kubernetes restart the container.
b)If a node dies --> kubernetes replicates the containers on to the other node..
c)If a container does no respond --> it kills the container.
5) Automated rollout and rollbacks:
Rollout - when any updates in app/config file is being deployed on to the container.
Rollbacks- Revert the changes of the app to the previous state.
At the time of rollout if anything fails then it will revert the changes so that there is no down time in the process as it do not kill the present instances.
6) Secret and Configuration management:
There is an object called secret outside the container and pod in a node that contains the sensitive data like passwords and tokens.Another object called config outside the container and pod in a node that contains the configuration of the container and pods.They are maintained separately to the docker image. Deploy and updates of these objects do not rebuild the docker image, and does not expose these in your stack configuration.
The secret and config are stored separatly in a ETCD database which is a key value data store, or the maximum size for the secret is 1MB.
7) Batch Exection:
Batch jobs require executables to run to completetion. In kubernetes run to completion jobs are used for the batch processing. We have a job controller for controlling the pod allocation. when ever a job arrives the job controller schedules the job to the pods. If the pod fails the controller with schedule the jobs to another container and pod of a node.Multiple pods can be run in parallel so that scaling up can take place.Once when the job processing is done the pods are shut down.
*Kubernetes supports batch processing,long-running jobs, and replace failed containers.
8) Horizontal Scaling:
Kubernetes can automatically scale up and scale down as per the requirement.
a) Horizontal pod autoscaler:It checks for CPU utilization and asks to set the number of pods to the Replication controller.
b) Manifest file:manifest file holds the number of replicas to be made, and the details is passed on to the replication controller.
c) Replication Controller:Ensures desired no of pods are maintained always. If any of the pod fails then container and pods are replaced.
1) Use the Kubernetes labs online by : katakode (kubernetes playgrounds), play with K8, play with kubernetes classrooms
2) Kubernetes installation tools: minikube, Kubeadm
3) Cloud based Kubernetes services
GKE- google kubernetes engine, Azure kubernetes services, Amazon EKS
we have the “Get things executed” lifestyle at our place of work. There are not any excuses, no if’s or however’s in our dictionary. committed to navigating the ship of creativity to create cell answers, we resolve the real-lifestyles troubles of our clients and their clients. Our passion for work has won us many awards, year after 12 months.
© Copyright Shadbox. All Rights Reserved
Rate Blog :
Share on :
Do you have any blog suggestion? please click on the link