Let’s Learn KUBERNETES..

Motivation

Why should we use Kubernetes? “Kubernetes is 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.” (Ref: Kubernetes.io)

 

What is Containerization? What is Container Orchestration?

  • “Containerization is an operating system-level virtualization or application-level virtualization over multiple network resources so that software applications can run in isolated user spaces called containers in any cloud or non-cloud environment” (Wikipedia)
  • With Docker Environment, we can create containers.
  • Kubernetes and Docker Swarm are the container orchestration and management tools that automate and schedule the deployment, management, scaling, and networking of containers.

Features

  • Service discovery and load balancing: Kubernetes can expose a container using the DNS name or using their own IP address. If traffic to a container is high, Kubernetes is able to load balance and distribute the network traffic so that the deployment is stable.
  • Storage orchestration: Kubernetes allows you to automatically mount a storage system of your choice, such as local storage, public cloud providers, and more.
  • Automated rollouts and rollbacks:  You can describe the desired state for your deployed containers using Kubernetes, and it can change the actual state to the desired state at a controlled rate.
  • Automatic bin packing: You tell Kubernetes how much CPU and memory (RAM) each container needs. Kubernetes can fit containers onto your nodes to make the best use of your resources.
  • Self-monitoring: Kubernetes checks constantly the health of nodes and containers
  • Self-healing: Kubernetes restarts containers that fail, replaces containers, kills containers that don’t respond to your user-defined health check
  • Automates various manual processes: for instance, Kubernetes will control for you which server will host the container, how it will be launched, etc.
  • Interacts with several groups of containers: Kubernetes is able to manage more clusters at the same time
  • Provides additional services: as well as the management of containers, Kubernetes offers security, networking, and storage services
  • Horizontal scaling: Kubernetes allows you to scale resources not only vertically but also horizontally, easily and quickly
  • Container balancing: Kubernetes always knows where to place containers, by calculating the “best location” for them
  • Run everywhere: Kubernetes is an open-source tool and gives you the freedom to take advantage of on-premises, hybrid, or public cloud infrastructure, letting you move workloads to anywhere you want
  • Secret and configuration management: Kubernetes lets you store and manage sensitive information

What is Kubernetes?

  • “Kubernetes is 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.” (Ref: Kubernetes.io)

The picture above describes the transformation of infrastructure from time to time, from traditional to virtualized and container deployment, and nowadays, all of the containers that we have deployed to serve our application will be managed by Kubernetes.

KUBERNETES ARCHITECTURE

  • Control Plane: User enters commands and configuration files from control plane. It controls all cluster.
    • API Server: “It exposes the Kubernetes API. The API server is the front end for the Kubernetes control plane.”
    • Etcd: “Consistent and highly-available key value store used as Kubernetes’ backing store for all cluster data (meta data, objects, etc.).”
    • Scheduler: “It 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,
        • deadlines.”
    • Controller Manager: “It 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: “It 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
      • 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: “Node components run on every node, maintaining running pods and providing the Kubernetes runtime environment.”
    • 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.”
    • Kube-proxy: “It is a network proxy that runs on each node in your cluster, implementing part of the Kubernetes Service concept.
      • It maintains network rules on nodes. These network rules allow network communication to your Pods from network sessions inside or outside of your cluster.
      • It 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: Docker, containerd, CRI-O, and any implementation of the Kubernetes CRI (Container Runtime Interface)”

Leave a Reply

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