Table Of Content -
- From Monolith to Microservices
- What are Containers
- Container Orchestrators
- Example of Container Orchestrators
- What is Kubernetes
- From Borg to Kubernetes
- Kubernetes Features
- CNCF
- What Problems Kubernetes Solves
- Kubernetes Architecture
- Installation
- Resources
- Demo
From Monolith to Microservices
Monolith - expensive hardware taste , 1000-line of codes , no documentation , downtime is active | passive , new challenges , not so modern programming language , outdated software architecture patterns & principles .
Microservices - can be deployed individually on separate servers , lesser compute resources expenses , developed & written in modern programming language , add complexity to architecture , greatest benefits in scalability , seamless upgrades & patches , no downtime , no service disruption , more productive , cost -efficient .
Microservices are like pebbles whereas monolith are 1000 ton of boulder , that are easier to carry . These pebbles are loosely coupled microservices , each performing a specific business .
What is Container ?
Container Images :-A container image is a ready to run software package , containing everything to run an app : the code , runtimes , dependencies in a pre-defined format .
Container Runtimes :- It is the software that is responsible for running container .
Kubernetes Support :- docker , CRI-O , containerd .
Containers are an application - centric method to deliver high performing , scalable, application on any type infrastructure of your choice . Container are best suited to deliver micro-services .
To Learn more about Docker checkout this article here
Container encapsulate micro-services and their dependency but do-not run them directly , instead run container images .**
Container Orchestration
Container orchestrators are tools which group systems , together to form cluster where containers deployment is automated at scale while meeting the requirements .
Example of Container Orchestration Solution
- Amazon Elastic Container Service
- Azure Container Instances
- Kubernetes
- Nomad
- Marathon
- Docker Swarm
- Apache Mesos
What is Kubernetes ?
Kubernetes is an open-source system for automating deployments, scaling & management of containerized application.
Kubernetes is Open Source Container Orchestrators Framework.
Think of Kubernetes as the pivot of on ship of containers.
Also referred as K8's(Kate's)
It is an Open source Project written in GO language . Kubernetes was started by Google & was donated to CNCF .
From Borg to Kubernetes
Borg has been Google Secret , running its worldwide containerized workloads in production. Gmail , drive , Maps were all serviced using Borg .
Some Features Of Kubernetes , that can be traced back to Borg , or to lessons learned form it -:
- API server
- POD
- IP-per-POD
- Services
- Labels
Kubernetes Features
Kubernetes offers a very rich set of features for container orchestration .
Automatic Bin Packing -
Kubernetes automatically schedules containers based on resource needs and constraints, to maximize utilization without sacrificing availability.Self-Healing
Kubernetes automatically replaces and reschedules containers from failed nodes.Horizontal Scaling
Horizontal Scaling means modifying the compute resources of an existing cluster.Service discovery & load balancing
Containers receive their own IP addresses from Kubernetes, while it assigns a single Domain Name System (DNS) name to a set of containers to aid in load-balancing requests across the containers of the set.Automated rollouts & rollbacks
Containers receive their own IP addresses from Kubernetes, while it assigns a single Domain Name System (DNS) name to a set of containers to aid in load-balancing requests across the containers of the set.Secret & configuration management
Kubernetes manages sensitive data and configuration details for an application separately from the container image, in order to avoid a re-build of the respective image.Storage Orchestration
Kubernetes automatically mounts software-defined storage (SDS) solutions to containers from local storage, external cloud providers, distributed storage, or network storage systems.Batch Execution
Kubernetes supports batch execution, long-running jobs, and replaces failed containers.
Other features that Kubernetes offers
- Clustering
- Scheduling
- Scalability
- High availability
- Fault Tolerance
- Disaster recovery
Cloud Native Computing Foundation [CNCF]
CNCF aims to accelerate the adoption of container , microservices & Cloud Native applications.
CNCF hosts a multitude of projects, with more to added in the future, CNCF provides resources to each of the project.
Projects within CNCF are categorized based on achieved status i.e. Sandbox , Incubating & Graduated
1) Graduated Projects -:
- Kubernetes for container orchestration
- Prometheus for monitoring
- Envoy for service mesh and many more
2) Incubating Projects -:
- CRI-O for container runtime
- linkerd for service mesh
- Contour for ingress
- etcd for key/value store
To learn more about CNCF PROJECT
CNCF & Kubernetes
- Provides a neutral home for the Kubernetes trademark and enforces proper usage .
- Actively markets Kubernetes.
- Provides license scanning of vendor & core code .
- Sponsors conference and meetup events .
- Supports adhoc activities .
What Problems does it solve ?
- Following the trend from monolithic to microservices - traditionally , an application would be a monolithic application which requires the hardware to scale with the applications. In comparison , Kubernetes deploys a large number web servers .
- Containers are the prefect host for small self-contained applications
- Applications comprised of 100s of containers - managing those with scripts can be really difficult and even impossible
- Kubernetes helps us with the following : connecting containers across multiple hosts , scaling them , deploying applications without downtime, and service discovery among several other aspects.
Kubernetes Architecture
A a very high level , kubernetes has the following main components-
- one or more master nodes , part of the control plane
- One or more worker nodes .
Master Node(Control Plane)
- provides a running environment for the control plane
- Responsible for managing the state of K8s cluster
- Brain behind all operations inside the cluster
- Several major components comprise the control plane: the API server, the scheduler, the controller-manager, and etcd.
kube-apiserver
- Administrative tasks are coordined by kube-apiserver, a central control plane component running on master node .
- Handles internal and external traffic
- The only agent that connects to the etcd database
- Acts as the master process for the entire cluster
- Each API call goes through three steps: authentication, authorization, and several admission controllers.
kube-scheduler
- The role of kube-scheduler is to assign new workload objects such as pods, to nodes . during the scheduling process ,decisions are made based on current k8's cluster state and new objects requirement .
- Scheduler is highly configurable and customizable
- Custom Scheduler is supported
etcd Database
- etcd is a strongly consisted , distributed key-value data store used to persist a kubernetes cluster state , new data is written to the data store only by appending to it , data is never replaced in data store , Obsolete data is compacted periodically to minimize the size of the data store .
- The state of the cluster, networking, and other persistent information is kept in an etcd database .
Other Agents
- The kube-controller-manager runs controllers responsible to act when nodes become unavailable , to ensure pod counts are as expected , to create endpoints , service account ,and API access tokens .
- The cloud-controller-manager runs controllers responsible to interact with the underlying infrastructure of a cloud-provider when nodes become unavailable , to manage storage volumes when provided by a cloud service and to manage load-balancing .
Worker Node
A worker node has following components -
- Container Runtime - CRI-O , containerd
- Node agent - Kubelet
- Proxy - kube-proxy
Kubelet:
- The Kubelet is agent running on each node and communicates with the control plane components from master node .
- It also monitors the health and resources of Pods running containers .
- Handles requests to the containers, manages resources and looks after the local nodes.
- It connects to container runtimes through a plugin based interface i.e. Container Runtime Interface (CRI).
Kube-proxy :
The kube-proxy is the network agent which runs on each node responsible for dynamic updates and maintenance of all networking rules on the node . It abstracts the details of Pods networking and forwards connection requests to POD .
Creates and manages networking rules — to expose container on the network .
Kubernetes Installation
Resources
1) Introduction to Kubernetes
2) TechWorld with Nana
Demo
Wanted to learn how to use Kubernetes , Checkout my blog post on Deploying a MongoDB on Kubernetes here .
Also checkout kubectl commands cheatsheet .
Hope you Folks Loved it !
Connect with me ❤️ -
Twitter
Top comments (0)