Kubernetes – Introduction & key concepts

From the last post on containers,we know what are containers & its benefits.Just to recap,here are the points below :

  1. Uses OS Level virtualization
  2. Isolated from each of them and from the host
    1. Filesystems
    2. Processes
    3. Resources
  3. Increased ease and efficiency of container image creation compared to VM image use.
  4. Provides reliable and frequent container image build and deployment with quick and easy rollbacks
  5. Create application container images at build/release time rather than deployment time, thereby decoupling applications from infrastructure.
  6. Raises the level of abstraction from running an OS on virtual hardware to run an application on an OS using logical resources.

Now we know what containers are & why do we need them,also note deploying lots of containers does require sophisticated management, though. Luckily, there is a solution that simplifies this, it is Kubernetes. lets see what it has to offer.

Kubernetes Introduction

The name Kubernetes originates from Greek, it means helmsman or pilot, and is the root of governor and cybernetic. K8s is an abbreviation derived by replacing the 8 letters “ubernete” with “8”.Kubernetes has been built based upon 15 years of experience of running production workloads at Google, combined with best-of-breed ideas and practices from the community.It groups containers that make up an application into logical units for easy management and discovery

Kubernetes is a production-ready, open source platform designed with Google’s accumulated experience in container orchestration, combined with best-of-breed ideas from the community. It is designed to automate deploying, scaling, and operating application containers.

Kubernetes logo
Image – Kubernetes

Kubernetes coordinates a highly available cluster of computers that are connected to work as a single unit. The abstractions in Kubernetes allow you to deploy containerized applications to a cluster without tying them specifically to individual machines.

In short,Kubernetes is

  • Portable: public, private, hybrid, multi-cloud
  • Extensible: modular, pluggable, hookable, composable
  • Self-healing: auto-placement, auto-restart, auto-replication, auto-scaling

Kubernetes Architecture – System & Abstractions

Following would help you to learn about the different parts of the Kubernetes system and the abstractions. Kubernetes automates the entire distribution and scheduling of application containers across a cluster in a more efficient way.

  1. To interact with Kubernetes, there is an API layer (Kubernetes API ) exposed same can be interacted using command-line interface via kubectl
  2. Any Kubernetes cluster (example below) would have two types of resources:
    1. Master which controls the cluster
    2. Node are the workers nodes that runs applications

      Kubernetes cluster
      Image – Kubernetes cluster
  3. The Master coordinates all activities in your cluster, such as scheduling applications, maintaining applications’ desired state, scaling applications, and rolling out new updates.
  4. Each Mode can be a VM or a physical computer that serves as a worker machine in a cluster.Each node has a Kubelet, which is an agent for managing the node and communicating with the Kubernetes master. The node should also have tools for handling container operations, such as Docker or rkt.
  5. When any applications needs to be deployed on Kubernetes, master issues command to start the application containers. The master schedules the containers to run on the cluster’s nodes.
  6. The nodes communicate with the master using the Kubernetes API, which the master exposes. End users can also use the Kubernetes API directly to interact with the cluster.
Kubernetes Abstractions
Image – Kubernetes Abstractions

Master components provide the cluster’s control plane. Kubernetes Control Plane consists of a collection of below processes on your cluster:

  • Kubernetes Master collection of three processes  kube-apiserver, kube-controller-manager and kube-scheduler.
    • kube-apiserver exposes the Kubernetes API. It is the front-end for the Kubernetes control plane.
    • kube-controller-manager runs controllers, which are the designed to handle routine tasks in the cluster.
  • Each individual non-master node on the cluster runs two processes:
    • kubelet – this is to communicate with Kubernetes Master
    • kube-proxy – this is nothing but network proxy (Kubernetes networking services) on each node.
    • kube-scheduler is to keep watch for newly created pods that have no node assigned, and selects a node for them to run on.

Master components make global decisions about the cluster (like for example, scheduling applications), and detecting and responding to cluster events.

Apart from the above,there are other objects to represent the state of system,some of the basic Kubernetes objects include:

  • Pod
  • Service
  • Volume
  • Namespace
  • Controllers

Kubernetes cluster can run on various platforms: from your laptop, to VMs on a cloud provider, to a rack of bare metal servers. To try with local Kubernetes setup, you can use Minikube. Minikube is a lightweight Kubernetes implementation that creates a VM on your local machine and deploys a simple cluster containing only one node.Minikube is available for Linux, macOS, and Windows systems. The Minikube CLI provides basic bootstrapping operations for working with your cluster, including start, stop, status, and delete.

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

Check out this lecture from Coursera on Kubernets introduction,it summarizes what we discussed above.

In the next post of Kubernetes tutorial, we can learn how to use Minikube CLI to create/deploy apps to the Kubernetes cluster.

Stay tuned..

Leave a Reply

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