Basic Concept of Kubernetes


Introduction to Basic Concept of Kubernetes


What is Kubernetes?
Kubernetes is an open-source platform/tool created by Google. It is written in GO-Lang. So currently Kubernetes is an open-source project under Apache 2.0 license. Sometimes in the industry, Kubernetes is also known as “K8s”. With Kubernetes, you can run any Linux container across private, public, and hybrid cloud environments. Kubernetes provides some edge functions, such as Loadbalancer, Service discovery, and Roled Based Access Control(RBAC).

Why we need Kubernetes?

The answer is to help us manage containers. When we run our production environments using a microservice pattern with many containers, we need to make sure many things. Such as health check, version control, scaling, and rollback mechanism. It will be very frustrating to make sure all of these things still be ok. Kubernetes gives you the orchestration and management capabilities required to deploy containers, at scale. Kubernetes orchestration allows you to build application services that span multiple containers, schedule those containers across a cluster, scale those containers, and manage the health of those containers over time. In nutshell, I can say Kubernetes is more like a manager that has many subordinates(containers). What manager does is maintain what subordinates need to do.
Before used Kubernetes, you need to prepare your infrastructure to deploy a new microservice. I believe it cost you a few days or weeks. Without Kubernetes, large teams would have to manually script the deployment workflows. With Kubernetes, you don’t need to create your deployment script manually and it will reduce the amount of time and resources spent on DevOps.
Key feature of Kubernetes:
·         Horizontal Scaling
·         Auto Scaling
·         Health check & Self-healing
·         Load Balancer
·         Service Discovery
·         Automated rollbacks & rollouts
·         Canary Deployment
How Kubernetes Works?
When you start the Kubernetes by reading the official documentation, you might be overwhelmed to encounter a lot of terminologies. Sometimes we need the overview to get a better understanding of the concept. Here I show you the complete overview diagram of Kubernetes Architecture. I hope this helps.
The sequence of deployment:
DevOps -> API Server -> Scheduler -> Cluster ->Nodes -> Kubelet -> Container Engine -> Spawn Container in Pod
The sequence of App user request:
App user -> Kube proxy -> Pod -> Container (Your app is run here)

Master

Master is the controlling element of the cluster. Master has 3 parts:
·         API Server: The application that serves Kubernetes functionality through a RESTful interface and stores the state of the cluster.
·         Scheduler: Scheduler watches API server for new Pod requests. It communicates with Nodes to create new pods and to assign work to nodes while allocating resources or imposing constraints.
·         Controller Manager: Component on the master that runs controllers. Includes Node controller, Endpoint Controller, Namespace Controller, etc.

Slave(Nodes) / Worker Node 

These machines perform the requested, assigned tasks. The Kubernetes master controls them. There 4 component inside Nodes:
·         Pod: All containers will run in a pod. Pods abstract the network and storage away from the underlying containers. Your app will run here.
·         Kubelet: Kubectl registering the nodes with the cluster, watches for work assignments from the scheduler, instantiate new Pods, report back to the master.
·         Container Engine: Responsible for managing containers, image pulling, stopping the container, starting the container, destroying the container, etc.
·         Kube Proxy: Responsible for forwarding app user requests to the right pod.