Monday, December 14, 2020

Kubernetes for Developers #1: Kubernetes Architecture and Features

Kubernetes(K8) is an open-source container orchestration tool used for automating deployment, scaling and management of containerized applications.

Features:

1. Self-Healing: It restarts container that failed or kills the container that do not respond to container health check endpoint. It always maintains user defined number of replicas

2. Secret and configuration management: It maintains an application level configuration and secrets in a separate location. So, it can be modified without re-building and deploying container

3. Horizontal scaling: It is easy to scale-up/down containers with a simple command or automatically based on CPU usage.

4. Automatic bin packing: It automatically places containers into the required Worker nodes based on specified CPU/Memory.

5. Storage orchestration: It allows to mount a local storage or cloud providers

6. Automated rollouts and rollbacks: It allows to rollout new application changes by spinning up new container without killing existing container until proper health check verified. It will rollback automatically if new container does not respond to user defined health check.

7. Service discovery and Load balancing: It does by using Labels and Selectors associated with PODs and Services, and can load-balance across them

Architecture & Components:

kubernetes architecture













Kubernetes(K8) architecture designed as a cluster. It consists of one master node and one worker node at least. It supports multiple master nodes and worker nodes.

1. Master Node

It is responsible for maintaining entire Kubernetes cluster and there might be more than one master node in the cluster for providing fault-tolerance and high availability.

It has various components like API Server, Control manager, Scheduler and etcd, commonly known as Control plane.  

    a) API Server: It is the only entry point for the entire cluster and exposes REST endpoints to  communicate with cluster.

    b) etcd: It is key-value data store used as maintain cluster data like configurations, network activities and etc

    c) scheduler: It is responsible for scheduling new POD based on nodes workload. It maintains resource information about each worker node and distribute workload accordingly.

    d) control manager: It has different individual processes to maintain cluster stability

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

     Replication controller: Responsible for maintaining the correct number of pods as per replica specification

     Endpoints controller: Populates the endpoint objects by using Labels and selectors of pods and services.

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

 2. Worker node:

 It is the place where every pod/container run. It consists of several components

  a) kubelet: It runs on each worker node and gets the pod specifications from API server and interact with the container runtime to perform start/stop of the container, mount pod volume and secrets.

 It monitors state of the pods by using heartbeat messages and transmit data to master node API server

  b) kube-proxy: It is a network proxy that runs on each worker node in the cluster, it maintains network rules to allow communication to the Pods from inside or outside of the cluster

It routes traffic to the appropriate pod based on the associated service name and the port number of an incoming request

 c) Container runtime: It is the software needs to be installed in each worker node to run the containers i.e. Docker, containerd etc.

 d) Pod: It is the place where single or multiple containers run together. 

Kubernetes for Developers Journey.

Happy Coding :)

2 comments: