Understanding Kubernetes (K8s) - part 1

Understanding Kubernetes

Hello there,
This is my first post and it is about Understanding Kubernetes. In general I have no idea if this site is going to take off, but I’m very excited!

My intention for this post is to have at least two parts. The first part of Understanding Kubernetes will be theoretical and during the second we will make our hands dirty (practical). So without further ado let’s go straight to the action.


Understanding Kubernetes History
(You won’t believe what K8s means)

It all started from Google who introduced the Borg System back in 2003-2004. Around 10 years later in mid-2014 – Google announced Kubernetes as an open source version of Borg.

The name Kubernetes originates from Greek, meaning helmsman or pilot. Furthermore:

You won't believe what K8s means! It is actually an abbreviation derived by replacing the 8 letters 'ubernete' with '8'. Click To Tweet


To Understand Kubernetes you should know what is container

The main idea of Kubernetes/K8s is to further abstract machines, storage, and networks away from their physical implementation. So it is a single tool to deploy containers to all kinds of clouds or local physical/virtual machines.

What is container you may ask? A container is kind of mini-virtual machine. It is small, as it does not have device drivers and all the other components of a regular virtual machine. Docker is the most popular container engine and this is how they describe it:

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.

Docker website

Nowadays containers are so popular and they even threaten to make VMs obsolete for many trivial tasks.

containers vs virtual machines
CONTAINERS vs VIRTUAL MACHINES

Why is Kubernetes needed?

First of all – There is a big issue with containers. You need to keep track of them. Cloud companies like Microsoft, Amazon, Google, etc. charge you for CPU time or storage, so you want to make sure you do not have any idle machines spinning out there doing nothing. Also there is the need to automatically scale when an App or Service needs more memory, CPU, or storage, as well as shut them down when the load lightens.

Orchestration deals with these problems. This is where Kubernetes comes in.

Understanding Kubernetes components

I will list a few main K8s components/terms to help you understand it better:

  • Node: a Node is a physical or virtual machine. It is not created by K8s. You create those in the Cloud or manually install them (Which we are actually going to do in Part 2 of this post). Basically you have to lay down your infrastructure before start using K8s to deploy your apps. After that point it can define virtual networks, storage, etc.
  • Pods: Containers are placed into pods to be managed by Kubernetes. A Pod is the basic execution unit of a K8s application–the smallest and simplest unit in the Kubernetes object model that you create or deploy. A Pod represents processes running on your Cluster.
  • Labels and selectors: Key-value pairs used to identify and group resources within Kubernetes.
  • Controllers: A reconciliation loop that drives actual cluster state toward the desired cluster state.
  • Services: A way to identify elements used by applications (name-resolution, caching, etc.).
  • Kubernetes control plane: Main controlling unit of the cluster that manages workload and directs communication across the system.
  • etcd: consistent and highly-available key value store used as Kubernetes backing store for all cluster data.
  • API server: Component on the Master node that exposes the Kubernetes API. It is the front-end for the Kubernetes control plane. Serves the K8s API using JSON over HTTP.
  • Scheduler: Pluggable component that selects which node a pod should run on based on resource availability.
  • Controller manager: The process that runs the Kubernetes controllers such as DaemonSet and Replication.
  • Kubelet: Responsible for the running state of each node (starting, stopping, and maintaining application containers).
  • Kube-proxy: The implementation of a network proxy and load balancer that supports the service abstraction.
  • cAdvisor: Is an open source container resource usage and performance analysis agent.
Kubernetes (K8s) Architecture
Kubernetes (K8s) Architecture

What can you do with Kubernetes?

You can use Kubernetes for:

  • Load Balancing – If there is a high demand towards a container, Kubernetes is able to load balance the traffic so that the deployment stays stable.
  • Storage management – you can configure K8s to automatically mount a storage of your choice (local storage, public cloud providers) if there is such need.
  • Automated rollouts and rollbacks – you can automate Kubernetes to create new replica containers for your deployment, remove existing replica containers and adopt all their resources to the new container.
  • Automatic bin packing – you can decide how much CPU and RAM each container needs, so Kubernetes can make decisions to manage the resource for the containers
  • Self-healing – Kubernetes can check the health of the containers and kill, restart, replace them behind the scene so the service stays without interruptions for the end users.
  • Secret and configuration management – You can let Kubernetes to store and manage passwords, OAuth tokens, ssh keys etc. without exposing them in stack configuration. You can also update the above mentioned credentials without rebuilding container images.


Understanding Kubernetes – Summary

Until now we have answered the following general questions:

Q: What is Kubernetes?
A: It is an orchestration tool for containers.
Q: What are containers?
A: They are small virtual machines that run ready-to-run applications on top of other virtual machines or any host OS.
Q: What is the benefit of using containers?
A: Containers greatly simplify deploying applications. And they make sure machines are fully-utilized. All of this lowers the cost of cloud subscriptions, further abstracts the data center, and simplifies operations and architecture.

To learn more about Kubernetes we will install MiniKube on one machine/node and play around with it in the next Part.

Meanwhile you can comment below what you think about this article also check the rest of my site/blog here.

Stay hungry! See you.


3 Comments

Maruthi Kumar Gajavalli · 28/08/2019 at 4:57 am

Good article, and thanks for taking effort in explaining K8s.
Small correction “so the service stays interrupted for the end users.’ It should be un-interrupted to make sure of no heart attacks for business users 🙂

    Kiril Peyanski · 28/08/2019 at 7:36 am

    Thank you very much Maruthi and I’m glad you like the article!

    Good catch – it is fixed already. I’m currently preparing a beautiful Kubernetes infographic, so you can subscribe for my newsletter and I will notify you when it’s ready.

    Cheers,
    Kiril

Kubernetes Infographic - Kiril Peyanski's Blog · 28/08/2019 at 11:46 pm

[…] to see even more information? Check my other post about Understanding Kubernetes and of course my beautiful Kubernetes Infographic […]

Leave a Reply

Your email address will not be published. Required fields are marked *