What exactly is Kubernetes anyway?
Tags: devops, beginners, kubernetes, learning
Published: 2020-09-09 09:22:17

*I spent some time learning about kubernetes this week as I want to understand the devops pipeline at my current role better. This post is essentially my organised notes so I can refer to it again when needed. Hopefully it may help others lost in the jargon understand better too* 🤷

Kubernetes is a platform for managing containerised workloads and services. All major cloud platforms have support for kubernetes including Google, AWS and Azure. 

**Okay but what does it *mean*?**

Let's go back in time for a minute, back in the old days applications would typically be deployed to a physical server, a human would be responsible for managing the application, allocating resources, monitoring the status, keeping the application up and running effectively. As applications grow and demand for the service grows this becomes increasingly difficult to manage and maintain. 

Flash forward a bit and we got virtualisation. This was great, virtualisation allowed us to run multiple Virtual Machines (VM) on one physical server. Each VM is encapsulated with its own operating system and other components. 

Things progressed even more and we got containerisation. Containers are similar to VMs but more lightweight, they are not as isolated and they share the same OS. You might have heard of [Docker](https://www.docker.com/), a very popular container solution. 

Here's a handy image of the evolution of deployment for reference:

![Evolution of Deployment](https://dev-to-uploads.s3.amazonaws.com/i/by5ov9dm4pw98wiwjnl2.png)

Okay cool, so now we have containers, we can throw our application into a container with the exact environment and configuration we want. Awesome! 

**What now?** 

Well now we have to manage those containers. This is where kubernetes comes in. Kubernetes helps us to orchestrate our containers. Orchestration is just a fancy word for a collection of tools and scripts that help host the containers. It enables us to:

- Easily deploy multiple instances
- Scale up and down depending on demand
- Network easily between hosts

**Cool, cool, cool, so how does this work?** 

Well, typically you will have a kubernetes cluster, a cluster is a set of nodes. A node is a physical or virtual machine in which kubernetes is installed. 

A node is a worker machine where containers will be launched and managed by kubernetes. How do we manage it? We have a master node, this node watches over the nodes in the cluster and is responsible for the orchestration of the nodes. The master will have different scripts and tools running which will be configured however you want to manage the cluster. 

The configuration can manage things like:
- load balancing
- service discovery
- sharing configuration across instances
- storage management 
- self healing 

An important distinction is that Kubernetes **does not build or deploy your application** but **provides tools to help you manage your environment**. 

Kubernetes is made up of the following components:

**API server**: This is the frontend of the system, the CLI talks to the API server to interact with the cluster. Here, you can make REST calls to manage shared state and configuration. 

**etcd server**: This is a key/value store used to store all data used to manage the cluster. This stores the data about all the nodes and masters in a distributed way. 

**scheduler**: This is responsible for distributing work across multiple nodes.

**controller**: This is the brain of the orchestration, it monitors for any issues or failures across the cluster and is responsible for responding accordingly if a node or container goes down.

**container runtime**: Software used to run the containers. e.g. Docker. 

**kubelet**: This is the agent that runs on each node within the cluster, they ensure the containers on the nodes are running as expected.

**kubectl**: Or Kube control tool, this is the CLI used to deploy and manage applications in the cluster. You can use it to get cluster information, the status of the nodes etc.

And that's my high level, novice take on what kubernetes actually is. Thanks for reading!!