DEV Community

Cover image for Deep dive into Kubernetes 0x1
Rahul Kumar
Rahul Kumar

Posted on • Updated on

Deep dive into Kubernetes 0x1

What is Kubernetes ?

Kubernetes is a portable and extensible open source container orchestration tool used for managing container workloads . Initially developed by google in 2014 and later managed by cncf .

Lets understand the deployment methods :

Going back in time

Traditional deployment era:

In early ages we have to deploy our application in the physical servers . We can not define the resource boundaries means if two applications are running on a same host there is no way we can divide the resource among each other . As a result the application would underperform .

Virtualized deployment era:

As a solution virtualization was introduced . It allows to run multiple virtual machines on top of your host machine . virtual machines allows application to run in a isolated environment so that they can run securely . Virtualization allows better resource management in a physical server which leads our applications to be scalable and loosely coupled . Each VM is a full machine running with it's own kernel with required binaries and libraries .

Container deployment era:

Container are similar to VMs but they don't required the kernel to run the application which makes them lightweight . for example : if you want deploy your application in Linux so you have to download the Linux VM Image (1.9 GB) , besides all the configuration needed . we could do that in just 90 MB and we don't have to additionally configure our Machine . But similar to VM container also it's own file system , share CPU, memory , process space and more .

Why we need Kubernetes ?

Previously we saw that Containers are providing such functionalities and everybody is moving towards containerized applications so we need somebody to manage those containers to ensure that there is no application downtime .

features of Kubernetes :

  • service discovery and load balancing .
  • self healing and disaster recovery .
  • Automated rollbacks and rollouts .
  • Automated scheduling .

  • Automated scheduling :
    Kubernetes provides advanced scheduler to lunch container on cluster nodes .

  • Self Healing Capabilities :
    Rescheduling , replacing and restarting the containers which are died .

  • Automated rollouts and rollbacks :
    This is for the desired state of the containerized application .

  • Horizontal scaling and load balancing :
    Kubernetes can scale up and scale down the application as per the requirement .

Components of Kubernetes :

Kubernetes works on a master-slave architecture . Slave nodes holds the containers every cluster must have one worker node .

Here is a diagram of a k8s cluster with all components tied together :
components of Kubernetes

Control plane components :

Control plane holds the control for the worker node and mange containers .

  • API server : It exposes the K8s API , by this we can make sure the communication between pod to pod and master to slave .
  • etcd : It is a highly available key-value store used to store the current state of the cluster and also used as a back up service for k8s .
  • Scheduler : This watches for new crated pods with no assigned nodes and assigned a node to run on them .
  • Control Manager :
    Controller Manager is a daemon that embeds controllers. It basically does namespace creation and garbage collection .

  • These controllers include :

  • Node Controller Manages the status of the nodes(create , update , delete)

  • Replication Controller Maintains number of pods for every replication controller object in the system .

  • Service Account And Token Controller Create default accounts and API access tokens for the new namespaces .

  • Endpoint Controller Takes care of endpoint objects(like pods, join services etc)

Node Components :

Node components run on every node and maintain the running pods .

  • Kubelet : It is running in each node and the task to make sure that the containers are running in the pod .
  • kubeproxy :
    It is a network proxy that runs on each node and mains the network rules .

  • Container runtime :
    This is responsible for running the containers .

How is Kubernetes different from docker swarm :

Alt Text

second part for Kubernetes

Top comments (3)

Collapse
 
andrealupo profile image
Wolf Developer

Interesting article! I'm starting the use of docker on spring-based web application and I know a container orchestrator is necessary. What do you think is better to start with? I get that Docker Swarm is easier to configure, but I don't know right now how to choose. I'll manage applications with 2-3 nodes, with no microservice involved (good old monolith..). Thank you in advance!

Collapse
 
rahulku48837211 profile image
Rahul Kumar

Your Welcome ......
I suggest you to use Kubernetes because of it's community support and if you are just starting with then Docker swarm could be little bit tricky and No GUI is available . And Kubernetes has so much functionality packed with .
So in Kubernetes i agree the Initial set up is tricky but once you set it up it is so easy to Manage .

Collapse
 
andrealupo profile image
Wolf Developer

Thank you for your reply! I'll go with Kubernetes then.