Akanksha Singh
LinuxWorld Informatics Pvt. Ltd.
7 min readDec 26, 2020

--

In this article I will explain that how industries use Orchestration tool to minimize Server Downtime and Data loss that result in continuous deployment over a Containerized environment with continuous integration through internal programs for achieving “Fast To Market” and Agile services that bring proper status to a business.

Slack — An Application for Chatbot, Group messaging and Broadcast Channels also uses Kubernetes for Event Notification. I will also touch the use-case of Kubernetes in Slack.

In real world when we work on Projects, the main issue comes in monitoring and maintain state of our environment that eventually terminates due to various reasons, this cause the production level loss to a company or an organization. Downtime in Service results in damage of business reputation and values in market.

Monitoring of Environment Continuously , all the time (i.e. 24 x 7) can be done to solve this Challenge but doing it with human intervention could be dangerous as at any point of time Server, cluster or application might collapse and a lot of time consume to provision and launch same environment again by doing things manually. So, now we will understand that why we need an Orchestration Tool like Kubernetes?

Orchestration helps in this issue i.e. monitoring the environment and making sure that the state remain the same in all conditions. When we go in deep research that how orchestration is done? We come to know that there are mainly two types of Orchestration: Manual and Scripting programs. Where Programmatic Orchestration further divides into two types: Imperative and Declarative approaches.

Types of Orchestration :-

  1. Imperative Orchestration : These are Classic way of writing Scripts and Programs that intend to create a software by analyzing all the steps and tasks that are manually done while provisioning and setup of that particular environment.
  2. Declarative Orchestration : An administrator defines a target state for a system (application, server, or cluster). Typically, a domain-specific language (DSL) is used to describe the target state. An administrative tool, such as Kubernetes, takes this definition as an input and takes care of how to achieve the target state from the current observable state.

About Kubernetes :-

Kubernetes is an Orchestration Tool that monitor and manage the Containers. It was designed by Google in 2014 and is a Open-Source tool. Kubernetes is established for deployment, maintenance and scaling of containers to maintain a particular state and provide Continuous support to the environment by various features that include Pods, Labels, Selectors, Controller, Replication Controller, Deployment Controller, Replica Set and Services.

Kubernetes uses declarative approach for Orchestration hence uses declarative language i.e. YAML or JSON to define the state of Server / Cluster / Application Environment that one need. The tool helps in launching the environment again by binding containerized Engine through kubelet program and application ports.

Features of Kubernetes:

Kubernetes achieves it’s working from the following features that helps it to maintain the state requested by the user, implementing the transition from the current observable state to the requested state.

POD : A pod is the smallest deployable unit that can be managed by Kubernetes. A pod is a logical group of one or more containers that share the same IP address and port space. The main purpose of a pod is to support co-located processes, such as an application server and its local cache.

LABEL : A label is a key/value pair that is attached to Kubernetes resource, for example, a pod. Labels can be attached to resources at creation time, as well as added and modified at any later time.

SELECTOR : A label selector can be used to organize Kubernetes resources that have labels. An equality-based selector defines a condition for selecting resources that have the specified label value. A set-based selector defines a condition for selecting resources that have a label value within the specified set of values.

CONTROLLER : A controller manages a set of pods and ensures that the cluster is in the specified state. Unlike manually created pods, the pods maintained by a replication controller are automatically replaced if they fail, get deleted, or are terminated. There are several controller types, such as replication controllers or deployment controllers.

REPLICATION CONTROLLER : A replication controller is responsible for running the specified number of pod copies (replicas) across the cluster.

DEPLOYMENT CONTROLLER : A deployment defines a desired state for logical group of pods and replica sets. It creates new resources or replaces the existing resources, if necessary. A deployment can be updated, rolled out, or rolled back. A practical use case for a deployment is to bring up a replica set and pods, then update the deployment to re-create the pods.

REPLICA SET : A replica set is the next-generation replication controller. A replication controller supports only equality-based selectors, while a replica set supports set-based selectors.

SERVICE : A service uses a selector to define a logical group of pods and defines a policy to access such logical groups. Because pods are not durable, the actual pods that are running may change. A client that uses one or more containers within a pod should not need to be aware of which specific pod it works with, especially if there are several pods (replicas).

Kubernetes Architecture

The Architecture is mainly divided into 3 parts : Worker Node, Master Node and CLI or Dashboard:

Worker NODE: A Kubernetes cluster consists of one or more nodes managed by Kubernetes. The nodes are bare-metal servers, on-premises VMs, or VMs on a cloud provider. Every node contains a container runtime (for example, Docker Engine), kubelet (responsible for starting, stopping, and managing individual containers by requests from the Kubernetes control plane), and kube-proxy (responsible for networking and load balancing).

MASTER NODE: A Kubernetes cluster also contains one or more master nodes that run the Kubernetes control plane. The control plane consists of different processes, such as an API server (provides JSON over HTTP API), scheduler (selects nodes to run containers), controller manager (runs controllers, see below), and etcd (a globally available configuration store).

DASHBOARD AND CLI: A Kubernetes cluster can be managed via the Kubernetes Dashboard, a web UI running on the master node. The cluster can also be managed via the command line tool kubectl, which can be installed on any machine able to access the API server, running on the master node. This tool can be used to manage several Kubernetes clusters by specifying a context defined in a configuration file.

Other Important Internal Components are:

kubelet :

The kubelet component is an agent that runs on every worker node of the cluster. It is responsible for managing all containers running in every pod in the cluster.

kube-proxy :

The kube-proxy component is a network proxy that runs on each node. It is responsible for forwarding requests. The proxy is somewhat flexible and can handle simple or round robin TCP, UDP or SCTP forwarding.

etcd :

etcd is a distributed, highly-available key value data store that Kubernetes uses to store cluster configuration. It holds metadata and the desired and current state for all resources. Any object or resource that is created is saved in etcd.

kube-apiserver :

The Kubernetes cluster is exposed via API and made available outside the cluster through the kube-apiserver component. The kube-apiserver is the only component that all other master and worker components can directly communicate directly with. Because of this, it serves as the interface for all cluster communications. All contact with the kube-apiserver uses a secure port.

kube-controller-manager :

Kubernetes manages applications through various controllers that operate on the general model of comparing the current status against a known spec. These controllers are control loops that continuously ensure that the current state of the cluster (the status) matches the desired state (the spec). There are mainly 4 types of Controller Managers : Node Lifecycle controller, Daemon Set controller, Deployment controller, Namespace controller.

kube-scheduler :

Since Kubernetes is an orchestration framework, it has built-in logic for managing the scheduling of pods. The kube-scheduler component is responsible for this.

Advantages of Kubernetes:

  1. MONITORING : As Kubernetes containers are actually Linux processes, we can use this tools to monitor cluster performance. Basic tools, such as top or kubectl top, will behave as expected. It’s also possible to use solutions that are dedicated to Kubernetes.
  2. HIGH AVAILABILITY : Deployment in Kubernetes is used to manage the pod and their state. when desire of user is done then Kubernetes have to deploy the thing in any condition. Internally Deployment remember the duty to manage the pod and replica count.
  3. SECURITY : Security Contexts to segregate privileges. Defining quotas for resources helps prevent DOS attacks. Selectively grant users permissions according to their business needs. Like the load balancer only needs to see a front-end service, while the back-end service has no need to contact the load balancer.
  4. SCALE : Kubernetes allows for adding and removing nodes dynamically. Each new node has to be configured appropriately and pointed at the master node. The main processes of interest are kubelet and kube-proxy.

How Slack is using Kubernetes ?

Kubernetes is used for event notification over Slack (a Chat-bot Application). It is used for creation, termination, update and restart notified through Slack for each activity of Kubernetes resources.

Kubernetes is using Life Cycle Hook to get Notifications for Pod Restarts. The post-start lifecycle is used for this purpose inside the declarative code.

For more details of Slack using Kubernetes in what ways and their internal concepts visit the article link : https://hackernoon.com/how-to-build-a-chatops-bot-with-slack-and-kubernetes-3r2b3yjr

I Hope the article would help you to understand the use of Kubernetes, it’s architecture and how it is working as an Container Orchestration Engine (COE).

Thanks for your time.

--

--

Akanksha Singh
LinuxWorld Informatics Pvt. Ltd.

Platform Engineer | Kubernetes | Docker | Terraform | Helm | AWS | Azure | Groovy | Jenkins | Git, GitHub | Sonar | NMAP and other Scan and Monitoring tool