What is Kubernetes?

Kubernetes which is also known as K8s is a production-grade open-source container orchestration tool developed by Google. It provides a portable, extensible, open-source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.

Why so popular?

To answer this question we need to go back in the time before Kubernetes.

Over time, enterprise-grade complex applications subjected to pass three remarkable ages of deploying applications in an efficient manner. 

Traditional deployment era

  • Monolithic development and deployment architecture on physical servers
  • Difficult to define the boundaries to allocate resources

Virtualized deployment era

  • Better utilization of resources in a physical server and allows better scalability
  • Microservice architecture came into the industry
  • Difficult to deploy and maintain applications in multiple environments

Container deployment era

  • Applications wrapped to run on multiple environments without dependency issues
  • enforce CI/CD architecture by reducing deployment time
  • Relaxed isolation compared to Virtual Machines

This way, the demand to support micro-service-driven architectural needs was escalated within the recent past. Moreover, businesses used to pay much attention to the high availability of their application for users. DevOps had to manage thousands of containers that run the applications and ensure that there is less downtime in the production environment. There the place where the requirement of an automated system to handle distributed systems arose.

The organizations that maintain a larger number of containers used to come up with the concept of container orchestration to overcome this issue. Container orchestration is the process of automating the management of container-based microservice applications across multiple clusters.

With the above concept, Kubernetes became the survivor of DevOps by providing a powerful framework to run distributed systems resiliently. It takes care of scaling and failover for your application, provides deployment patterns, and more.

What Kubernetes provides?

  • Service discovery and load balancing
  • Storage orchestration
  • Automated rollouts and rollbacks
  • Automatic bin packing
  • Self-healing
  • Secret and configuration management

Fundamental Architecture Of Kubernetes Cluster

The architecture of the Kubernetes can be divided into two major components for ease of understanding.

Let’s break down these components one by one and discuss the most common terms of Kubernetes.

Control Plane Components

 The control plane manages the worker nodes and the Pods in the cluster. Making global decisions about the cluster, as well as detecting and responding to cluster events are key responsibilities of the control plane.

Control plane components can be run on any machine in the cluster. However, for simplicity, set up scripts typically start all control plane components on the same machine, and do not run user containers on this machine.

So the control plane interact with the worker node to

  • Schedule the pods
  • Monitor the worker nodes/Pods
  • Start/restart the pods
  • Manage the new worker nodes joining the cluster

Using the following key processes

Let’s look into each one of the processes in detail

kube-apiserver

The API server is a component of the Kubernetes control plane that exposes the Kubernetes API. The API server is the front end for the Kubernetes control plane.

The main implementation of a Kubernetes API server is kube-apiserver. kube-apiserver is designed to scale horizontally—that is, it scales by deploying more instances. You can run several instances of kube-apiserver and balance traffic between those instances.

etcd

Consistent and highly-available key-value store used as Kubernetes’ backing store for all cluster data.

If your Kubernetes cluster uses etcd as its backing store, make sure you have a backup plan for those data.

You can find in-depth information about etcd in the official documentation.

kube-scheduler

Control plane component that watches for newly created Pods with no assigned node, and selects a node for them to run on.

Factors taken into account for scheduling decisions include:

  • Individual and collective resource requirements
  • Hardware/software/policy constraints
  • Affinity and anti-affinity specifications
  • Data locality
  • Inter-workload interference, and deadlines.
kube-controller-manager

Control Plane component that runs controller processes.

Logically, each controller is a separate process, but to reduce complexity, they are all compiled into a single binary and run in a single process.

Some types of these controllers are:

Node controller: Responsible for noticing and responding when nodes go down.

Job controller: Watches for Job objects that represent one-off tasks, then creates Pods to run those tasks to completion.

Endpoints controller: Populates the Endpoints object (that is, joins Services & Pods).

Service Account & Token controllers: Create default accounts and API access tokens for new namespaces.

cloud-controller-manager

A Kubernetes control plane component that embeds cloud-specific control logic. The cloud controller manager lets you link your cluster into your cloud provider’s API, and separates out the components that interact with that cloud platform from components that only interact with your cluster.

The cloud-controller-manager only runs controllers that are specific to your cloud provider. If you are running Kubernetes on your own premises, or in a learning environment inside your own PC, the cluster does not have a cloud controller manager.

As with the kube-controller-manager, the cloud-controller-manager combines several logically independent control loops into a single binary that you run as a single process. You can scale horizontally (run more than one copy) to improve performance or to help tolerate failures.

The following controllers can have cloud provider dependencies:

Node controller: For checking the cloud provider to determine if a node has been deleted in the cloud after it stops responding

Route controller: For setting up routes in the underlying cloud infrastructure

Service controller: For creating, updating, and deleting cloud provider load balancers

Node Components

Whoever the person used to manage Kubernetes clusters often deals with the nodes. Actions on the nodes may include deploying containerized applications, autoscaling, roll back updates on production servers &, etc.

Node components run on every node, maintaining running pods and providing the Kubernetes runtime environment. A node can have one or more pods which represent an abstraction of a containerized application. Each of these nodes run following 3 key processes

kubelet

An agent that runs on each node in the cluster. It makes sure that containers are running in a Pod.

The kubelet takes a set of PodSpecs that are provided through various mechanisms and ensures that the containers described in those PodSpecs are running and healthy. The kubelet doesn’t manage containers which were not created by Kubernetes.

kube-proxy

kube-proxy is a network proxy that runs on each node in your cluster, implementing part of the Kubernetes Service concept.

kube-proxy maintains network rules on nodes. These network rules allow network communication to your Pods from network sessions inside or outside of your cluster.

kube-proxy uses the operating system packet filtering layer if there is one and it’s available. Otherwise, kube-proxy forwards the traffic itself.

Container runtime

The container runtime is the software that is responsible for running containers.

Kubernetes supports several container runtimes

and any implementation of the Kubernetes CRI (Container Runtime Interface).

Addons

Addons use Kubernetes resources (DaemonSet, Deployment, etc) to implement cluster features. Because these are providing cluster-level features, namespaced resources for addons belong within the kube-system namespace.

Selected addons are described below; for an extended list of available addons, please see Addons.

DNS

While the other addons are not strictly required, all Kubernetes clusters should have cluster DNS, as many examples rely on it.

Cluster DNS is a DNS server, in addition to the other DNS server(s) in your environment, which serves DNS records for Kubernetes services.

Containers started by Kubernetes automatically include this DNS server in their DNS searches.

Web UI (Dashboard)

Dashboard is a general purpose, web-based UI for Kubernetes clusters. It allows users to manage and troubleshoot applications running in the cluster, as well as the cluster itself.

Container Resource Monitoring

Container Resource Monitoring records generic time-series metrics about containers in a central database, and provides a UI for browsing that data.

Cluster-level Logging

A cluster-level logging mechanism is responsible for saving container logs to a central log store with search/browsing interface.

Hence the basic concept review on Kubernetes concluded. Thank you for reading and hope you got a basic idea about Kubernetes.

See you in another tech review.

Leave a Reply

Your email address will not be published. Required fields are marked *