Kubernetes Architecture and Components, Kubernetes Installation and Configuration

Kubernetes - Overview:

Kubernetes is an open-source container management tool hosted by Cloud Native Computing Foundation (CNCF). This is also known as the enhanced version of Borg which was developed at Google to manage both long-running processes and batch jobs, which were earlier handled by separate systems.

Kubernetes comes with the capability of:

  • automating deployment,

  • scaling of applications, and

  • operations of application containers across clusters. It is capable of creating a container-centric infrastructure.

Features of Kubernetes

Following are some of the important features of Kubernetes.

  • Continues development, integration and deployment

  • Containerized infrastructure

  • Application-centric management

  • Auto-scalable infrastructure

  • Environment consistency across development testing and production

  • Loosely coupled infrastructure, where each component can act as a separate unit

  • Higher density of resource utilization

  • Predictable infrastructure which is going to be created

One of the key components of Kubernetes is, it can run applications on clusters of physical and virtual machine infrastructure. It also can run applications on the cloud. It helps in moving from host-centric infrastructure to container-centric infrastructure.

Kubernetes - Cluster Architecture

Kubernetes follows a client-server architecture. Wherein, we have the master installed on one machine and the node on separate Linux machines.

Components of K8s:

Kubernetes - Master Machine Components

Following are the components of Kubernetes Master Machine.

  • etcd:

    #Stores metadata and status of the cluster.

    #etcd is a consistent and high-available store (key-value-store).

    #Source of touch for cluster state (info about the state of the cluster).

  • API Server

    #This api-server interacts directly with the user (i.e we apply .yml or .json manifest to kube-api-server).

    #This kube-api-server is meant to scale automatically as per load.

    #Kube-api-server is the front end of the control plane.

  • Controller Manager

    # Make sure the actual state of the cluster matches the desired state.

→ Two possible choices for controller manager —

  1. If K8s is on the cloud, then it will be a cloud controller manager.

  2. If K8s is on non-cloud, then it will be kube-controller-manager.

# The key controllers are replication controller, endpoint controller, namespace controller, and service account controller. The controller manager runs different kind of controllers to handle nodes, endpoints, etc.

  • Scheduler

    #When users request the creation & management of Pods, Kube-scheduler is going to take action on these requests.

    #Handles POD creation and Management.

    #Kube-scheduler match/assign any node to create and run pods.

    #A scheduler watches for newly created pods that have no node assigned. For every pod that the scheduler discovers, the scheduler becomes responsible for finding the best node for that pod to run.

    #The scheduler gets the information for hardware configuration from configuration files and schedules the Pods on nodes accordingly.

    It is a service in master responsible for distributing the workload. It is responsible for tracking utilization of working load on cluster nodes and then placing the workload on which resources are available and accept the workload. In other words, this is the mechanism responsible for allocating pods to available nodes.

    #The scheduler is responsible for workload utilization and allocating pod to new node.

Kubernetes - Node Components

Following are the key components of Node server which are necessary to communicate with Kubernetes master. Node is going to run 3 important pieces of software/process.

  • Kubelet

    #The agent running on the node.

    #Listens to Kubernetes master (eg- Pod creation request)

    #Use port 10255.

    #Send success/Fail reports to master.

  • Container Engine

    #Works with kubelet.

    #Pulling images.

    #Start/Stop Containers.

    #Exposing containers on ports specified in the manifest.

  • Kube-Proxy

    #Assign IP to each pod.

    #It is required to assign IP addresses to Pods (dynamic).

    #Kube-proxy runs on each node & this makes sure that each pod will get its unique IP Address.

Kubernetes - Master and Node Structure

Kubernetes Installation and Configuration:

Instance Creation:

  • select UBUNTU AMI

  • choose T2.medium (for K8s cluster)

  • Allow SSH+HTTP+HTTPS parameter for accessing.

  • Launch your instance.

Update Ubuntu system:

sudo apt-get update

Install Docker Pkg:

sudo apt-get install docker.io

Installation of Minikube pkg:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64

Add user & group & give SUDO privileges:

sudo usermod -aG docker $USER && newgrp docker

Start your cluster & specify the default driver:

minikube start --driver=docker

Connect to your cluster of Master & Node:

minikube ssh

Install Kubectl:

Minikube is a tool that enables you to run a single-node Kubernetes cluster on your local machine. It is an easy way to get started with Kubernetes without having to set up a full cluster.

sudo snap install kubectl --classic