top of page
Writer's pictureSathish Kumar

Introduction to Kubernetes

Updated: Jan 15, 2021


Before we get into Kubernetes, let me do a quick recap:


So, What is Kubernetes?


Kubernetes (or K8) is an orchestration system and an alternative to Docker Swarm. Kubernetes uses Docker hosts to host containers. Kubernetes was originally developed by Google and open-sourced in 2015, it's maintained by the open-source community now.


There are different distributions of Kubernetes depending on deployment- Cloud or on-premise. Amazon AWS, Google's GCP have their own distribution of Kubernetes that can be deployed on respective cloud platforms. For on-premise deployments, there are choices like Docker-Enterprise, OpenShift, Canonical, VMWare PKS. Due to vendor support, Kubernetes has become very popular and is often the first choice of orchestration system for containers.


Let's look at the requirements of a container orchestration system and how it can be accomplished with Kubernetes:


  1. Ability to run multiple replicas of service across multiple hosts:

Once the Kubernetes cluster is setup this can be accomplished with a single command:


kubectl run --replicas=1000 mycustomapp

2. Ability to scale replicas dynamically (horizontal scaling)


 kubectl scale --replicas=2000 mycustomapp

3. Ability to do "rolling upgrades" for all instances with a single command


 kubectl rolling-update mycustomapp --image=mycustomapp:2

4. Ability to "rollback" to a previous version if there are problems with the upgrade



 kubectl rolling-update mycustomapp --rollback

A Kubernetes cluster consists of a set of nodes (Docker hosts with Kubernetes). Containers are launched on these nodes. Each cluster has a master (similar to Manager/Leader in Docker swarm) that manages services across nodes with a control plane protocol. Replicas of service can be run across nodes in a cluster. If a node fails, replicas running in the failed node are automatically launched on other nodes by the master.


When Kubernetes is installed, it installs various software components:






API Server: This is front end for Kubernetes. Command-line, devices, users talk to the Kubernetes cluster via the API server.


etcd: This is a distributed key-value store used to store data required to manage the cluster (control plane). The consistency of data across nodes is ensured.


Scheduler: This is responsible for distributing the workload across nodes in the cluster when new services are created.


Controller: The controller is responsible for bringing up new containers on active nodes in case of failures among other things.


Container Runtime: This is Docker in most cases.


Kubelet: This ensures containers are running on nodes as expected. This is like a "heartbeat" for cluster health.


Finally, kubectl is the command line for deploying and managing services/nodes/containers in a cluster.


I Hope, this introduction to Kubernetes was useful. In the next article, I will show you how to install Kubernetes on Ubuntu and set a Kubernetes cluster.



180 views0 comments

Comments


bottom of page