Table of Contents
Containerization is a buzz word in cloud computing. Transformation of modern applications infrastructure is revolutionized by container technology. Containers let virtualization of the host operating system effectively, and isolate application dependencies from other containers running on the same system.
Before the advent of containers, if multiple applications were required to be deployed on virtual machine, then any changes on shared infrastructure could cause unexpected results due to which it was advisable to run one application per virtual machine but it wasted lot of resources as VM will not just run application but full operating system also which requires resources. With containers this wastage is addressed by having container engine and container image which is a package of an application and its dependencies.
In today’s article we would venture more in detail about Kubernetes platform which is an open-source container management solution, learn about its architecture, features, use cases and so on.
What is Kubernetes?
Kubernetes or K8 is an open-source container management platform developed by Google which unifies a cluster of machines into a single pool of computing resources. With Kubernetes we can organize applications in container groups which run its docker engine to maintain applications running as per request. Kubernetes keeps track of container applications which are deployed in cloud
Features of Kubernetes
- Compute scheduling considering resource needs of containers and find right place and run them automatically.
- Self-healing in nature so if container crashes a new one will be created to replace it.
- Horizontal scaling can be achieved by observing CPU and memory metrics , add and remove instances as required.
- Volume management is easy as it manages the persistent storage used by applications.
- IP address , DNS and multiple instances load balancing.
- During upgrade health of new instances is monitored and if failure occurs rollback happens to previous version automatically.
- Management of application configuration and secrets.
- Large scale application deployments
- Management of microservices
- CI/CD software development
- Server less computing
- Hybrid and multi-cloud deployments
- Big data processing
- Machine learning
Kubernetes Architecture & Working
Kubernetes cluster has its own data and control plane.
The Control Plane
The control plane comprises several components such as API server, metadata store for maintaining cluster state, multiple controllers to manage nodes in the data plane and enable user access. The control plane is distributed across multiple systems for high availability and robust infrastructure. The data plane comprises multiple nodes or workers. The control plane deploys and runs pods (a group of containers) on nodes, looks for changes and responds. Let’s look in detail about components in Kubernetes architecture.
It is a command line tool used to interact with the Kubernetes cluster. The control plane consists of API server, the etcd metadata store, Scheduler, Controller manager and cloud controller manager.
The Kube API Server is REST server which exposes Kubernetes APIs to the external world. We can have multiple instances of API server in the control plane for high availability. API server cluster state is kept in etcd.
The complete cluster is stored in etcd (https://coreos.com/etcd/) , which is a consistent, reliable and distributed key value store. The etcd store is an open-source object developed by CoreOS initially. For redundancy 3 to 5 instances are maintained if you lose data in etcd store you lose your cluster also.
Kube-scheduler is responsible for scheduling Pods to worker nodes. Implementation of sophisticated scheduling algorithms takes a lot of information into account such as availability of resources on each node, constraints mentioned by user, type of available nodes, resource limits and quotas, and other factors such as affinity , anti-affinity, tolerations and taints.
The Kube controller manager is a single process which has multiple controllers to achieve simplicity. These controllers keep a watch on changes and respond accordingly
- Node controllers are responsible for notice and respond when a node goes down
- Replication controller ensure there is correct number of pods for each replica set or objects for replication controller
- Endpoints controller assign for each service an endpoint object which lists the service pods
- Service account and token controllers initialize new namespaces with default service account and corresponding API access tokens
The Data Plane
The data plane comprises nodes in the cluster which run containerized workloads or pods. The data plane and control plane share physical and logical machines. In order to communicate to nodes Kubernetes installs several components on each node, watch, schedule pods etc
The Kubelet is Kubernetes agent and responsible for talking to API servers and running and managing pods on the node. Kubelet is responsible for :
- Download pod secrets from API server
- Volume mounts
- Pod container running via container runtime interface (CRI)
- Report status of each Pod and node
- Probe container liveness
Networking aspects are handled by this component for the node. It operates as local front for services and forwards TCP and UDP packets and discovers IP addresses of services via DNS or environment variables
Kubernetes runs containers and supports a variety of container runtimes. Docker is supported initially. Kubernetes runs containers via an interface known as CRI which is based on gRPC.
Quick facts !
Kubernetes has 25.73% market share in the containerization market.