Kubernetes

  • Post author:
  • Reading time:9 mins read
5
(5)

Introduction to Kubernetes

Kubernetes is an open-source container orchestration platform that can automate deployment and manage containerized applications across multiple hosts.

Kubernetes is widely used in microservices architectures, where applications are broken down into smaller services. Kubernetes container orchestration system automates the scaling, deployment and   management of microservice applications. Microservice framework allows you to manage hundreds or thousands of containers at production scale.

Why you need Kubernetes?

Modernized Application are focusing on Container based approach where application can be easily scalable, portable and used efficiently. Kubernetes container orchestrator automatically deploy and manages containerized application. Containers can be dynamically increased or decreased as per change in environment needs. Whenever there is a Business need to deploy and scale resources widely across multiple regions then K8S is the best Choice as it is designed to support large systems.

Kubernetes can provide Complete solution for enterprise Application which is highly business critical where an application crash disrupts the entire service. Kubernetes Discovery and Network services can immediately identifies and spans  in a  new instance of the container without any  Downtime. K8S manages the entire lifetime cycle and networking of multiple clusters.

If we are deploying a simple monolithic web application using Kubernetes may not bring Value. Kubernetes supports diverse variety of workloads, including stateless, stateful, and data-processing workloads.

Kubernetes Benefits

      • Applications hosted in Kubernetes are more Resilient.
      • Scales containerized application automatically based on CPU and memory usage.
      • Kubernetes takes care of Container Application failover guaranteeing High Availability.
      • Automated Rollouts & Rollback – K8S progressively rolls out changes and Configuration to application by creating new Containers for deployment & rollback changes to remove the containers and reallocate as per needs.
      • Storage Solution – Automatically mounts and manages variety of storage system ranging from local storage, NFS, iSCSI and other Cloud storage service.
      • Service Discovery – This route traffic to different parts in a distributed application
      • Load balancing – When traffic to a container is high Kubernetes distribute the network traffic over multiple worker nodes for a stable deployment.
      • Self-Healing – Kubernetes automatically restarts the failed containers or replaces the containers and kill the containers which are not responding.
      • Kubernetes can optimize resource allocation and utilization, ensuring that containerized applications are running efficiently.
      • Kubernetes can be used to manage containerized applications across multiple cloud environments, on-premises and hybrid cloud.
      • Kubernetes store and manage passwords, tokens, and SSH keys.

Kubernetes Architecture

One or more Virtual Machines or Physical servers combine to form a Cluster. Kubernetes Cluster consists of Master Nodes and Worker Nodes.

Master Node: The Control Plane in Master Node  manages the worker nodes and the Pods in the cluster. Control plane can run on single master node or replicated across multiple master nodes for HA.

Components in Control Plane:

  • API Server : The API Server exposes APIs to support Horizontal Scaling.
  • Controller Manager  : Controller Manager is a daemon that continuously gather information and watches the state of the cluster and change them to desired state. The Control manager administers nodes and endpoints. 
  • Scheduler : The Scheduler is responsible for the scheduling and distributing container workloads across the nodes in the cluster.
  • etcd : etcd stores key value data of cluster state. This is stateful and persistent storage that stores all of Kubernetes cluster data .
  • Cloud Controller manager – The cloud controller manager integrates Kubernetes cluster with cloud provider (AWS, Azure, Google etc)

Worker Node:

Below are the important Components on Node.

Kubelet: Kubelet is an agent that runs on each node in the cluster. It makes sure that containers are running in a pod.

Kubeproxy:  Kubeproxy maintains network rules on each nodes in Cluster. It manages IP translation and routing.

Container Runtime engine: Each worker node has a Container Runtime engine like docker which is responsible for running containers inside Pods. The Container pulls image from Container registry.

Pods: Node can run multiple pods. Each pod contains one or more container. pod represents a running process on a cluster. Developers use pods to package application in a single or multiple containers. When a pod is deployed or killed, all of the containers inside it are started or killed together. So, application services which has different scaling, deployments needs and life cycle management can be deployed in a separate Pod.

Deployment in Kubernetes:

Kubernetes support multiple deployment strategy like rolling updates, Blue-green and canary. Deployments are used to define the pods; it provides instruction to Kubernetes on how to create or modify instances of the pods that hold a containerized application. Developer writes a manifest file (yaml or Json) to define the desired state of an application with pod definition, required replicas, the Docker image to be used etc. This file is handled by the Kubernetes API server to carry out the instruction. The Kubernetes Monitor component continuously to ensure the current state matches the desired state.

Kubernetes Services

Kubernetes Services exposes set of pods on the network so that clients can interact with them. When a deployment is created a service is also created with the application pods. When a pod has to communicate with another pod it sends the request to the service, which is responsible for passing the request to the pod. Services acts as an internal load-balancer for the pods. Pods talk to other pods via services, instead of contacting them directly.

Ingress

Kubernetes supports Ingress, it exposes HTTP/HTTPS routes from outside the cluster to your services. If a asp.net application is running in a pods it can handle the request from external users by adding ingress service.

Kubernetes Tools:

Kubectl : This is a Command line interface Used to deploy and manage cluster.This is  the default CLI tool for Kubernetes.

Kubelet :Kubelets are node agents  that run on each node of Kubernetes  cluster and monitor the Nodes .

Kubeless : This tool is a native Kubernetes tool used to deploy small applications.

Kubectx : kubectx is a useful  in multi-cluster environments.

MiniKube :  Minikube is a lightweight Kubernetes implementation that can deploy cluster with single node on local computer.Used for learning  and small development  purpose.

Kubeadm : create and manage Kubernetes clusters

Kube Dashboard :Web Interface to get information on Clusters,  It provides a UI to manage Kubernetes tasks like load balancing, performance, Workload health, discovery and monitoring memory and CPU usage.

Other Container Orchestration tools in the Market

There are several other container orchestration tools available in the market, each with its own strengths and weaknesses. Overall, the choice of container orchestration tool depends on your specific needs and requirements. Factors to consider include ease of use, scalability, fault-tolerance, and compatibility with  existing infrastructure and workflows.

Here are some popular ones:

Docker Swarm: Docker Swarm is a container orchestration tool that is included with Docker.It provides a simple and easy-to-use interface for deploying and managing containerized applications. Swarm is easier to configure and use hence it is widely used in small-scale usage scenarios and development teams.

Apache Mesos: Apache Mesos is a distributed systems kernel that can be used for container orchestration. Mesos is easier to set up compared to other Orchestration Tools. Mesos can run both containerized and non-containerized workload, provides a highly scalable and fault-tolerant platform for managing containerized applications.

Amazon Elastic Container Service (ECS): Amazon ECS is a fully-managed container orchestration service that runs on Amazon Web Services (AWS). Amazon ECS is serverless (No control planes or nodes to manage) and integrate with Amazon Fargate.Here we need to pay only for the resources we use and EKS management layer cost per cluster

Azure Kubernetes Service (AKS): Azure Kubernetes Service is a managed Kubernetes offering from Microsoft. Reduces the Complexity of container-based application deployment and management. When you create an AKS cluster, a control plane is automatically created and configured with no cost as a managed Azure resource, need to pay only for the nodes attached to the AKS cluster.

Google Kubernetes Engine (GKE): Google Kubernetes Engine is a fully-managed container orchestration service that runs on Google Cloud Platform (GCP). It provides a highly available and scalable platform for managing containerized applications is used exclusively in stateful Application.

HashiCorp Nomad: HashiCorp Nomad is a container orchestration tool that can be used to manage both containers and non-containerized applications. It provides a flexible and scalable platform for managing workloads across multiple hosts and cloud environments.

Kubernetes is a powerful platform for container orchestration, but it can also be complex and challenging to manage particularly for smaller organizations or those with limited resources. Careful planning and management are required to ensure that Kubernetes is used effectively and efficiently

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 5

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply