Containerization
Containerization is a virtualization technique in which the application and all its dependencies are packed into a single isolated package called a container and can be run on the host OS, virtual machines and on cloud.
Need for Containerization
Every business depends on software and every software needs its own set of dependencies. Containerization helps to bundle the applications and its dependencies into an isolated package that can run on any platform or OS.
Container Orchestration
Kubernetes is a Container Orchestration System but what is container orchestration and why do you even need it.
Need for Container Orchestration
A useful application depends on other applications/functionalities to complete a task. It's good to keep logically distinct applications/functionalities separate , it helps in developing, testing , scaling and deployment. But these applications need to interact with each other to become a useful software system. This is where container orchestration comes into picture, it runs and manages multiple containers containing different applications or different functionalities of a single application and establishes communication between them.
What is Kubernetes?
Kubernetes is an open source container orchestration platform, used for deploying, scaling, updating and managing containerized applications.
It was developed by Google and is now maintained by CNCF(Cloud Native Computing Foundation).
Kubernetes Architecture
The Master Components
Every Kubernetes cluster contains at least one Master node. The Master node manages the cluster , it controls the Worker nodes in the cluster and makes decisions regarding scheduling, scaling and updating the application.
You can communicate to the master node via kubectl CLI or the APIserver.
The different components of a Master node are
Kube-apiserver
etcd key-value store
kube-scheduler
kube-controller-manager
Note: Kubernetes master can run on any machine but all master components must run on the same machine and no nodes should run in that machine.
Master Components
kube-apiserver
The kube-apiserver connects to the Kubernetes API and helps to perform all the administrative tasks given by the user and stores the cluster state in etcd key-value store after all the executions are done . It is the front end on Kube control plane. It is scaled horizontally i.e it scales by increasing the number of instances.
etcd
etcd is a highly reliable and distributed key-value store which is used to store the data regarding cluster state. It can be part of the master node or can be external in which case the master node connects to it.
Scheduler
Responsible for assigning pods (the smallest deployable units in Kubernetes) to worker nodes based on resource availability, constraints, and other policies.
Controller Manager
Manages various controllers that handle different aspects of the cluster, such as node management, replication, and endpoints.
Cloud Controller Manager (optional): Integrates with cloud provider APIs to manage cloud-specific resources like load balancers, storage, and networking
Worker node components
Every Kubernetes cluster has a number of worker nodes. These worker nodes are also called as nodes. The nodes are controlled by the Master and run the application or a part of an application using pods .
The different node components are
kubelet
kube-proxy
container runtime
kubelet
It is a worker node component that runs on every worker node in a cluster and is used to communicate with the master node. It runs containers inside a pod according to pod-spec.
A pod-spec is YAML or JSON file that contains information regarding which containers should be run in the pod.
kube-proxy
It is a kubernetes network proxy service that runs on every node, it is used to connect the application to the external world/environment. Instead of directly connecting to the pods to interact with the application Services are used.
Container Runtime
Container Runtime Every container must have a container runtime, it is used to run and maintain containers in a node. Container runtime are tools or software that are used to create and run containers. Eg: dockers and rkt