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, a very popular container solution.
Here's a handy image of the evolution of deployment for reference:
Okay cool, so now we have containers, we can throw our application into a container with the exact environment and configuration we want. Awesome!
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!!
Top comments (10)
One minor thing I want to point out is that there is no single component called the controller (though there is a
kube-controller-managercomponent). Rather, controller in Kubernetes is more of a generic term for processes that implement state reconciliation / control-loops. For example, there's an Endpoints Controller that continuously watches
Podsto update the relevant
Endpointresources. And there's a ReplicaSet Controller that makes sure the number of running
There's a whole bunch of them and the standard ones run as part of the kube-controller-manager, but additional stuff you may install on your cluster often comes with its own controllers.
As you mentioned, these things run continuously to make sure the actual state of the cluster matches your desired state of things.
Just wanted to point this out cause as you get deeper into Kubernetes you'll see folks talk about controllers all the time and they're not necessarily talking about the built-in ones.
Thank you so much for this explanation, it’s really helpful!!
This was a really good introduction!
Being someone who doesn't know much about this subject, I'd be super happy if you wrote another article, this time focusing in the practical, step by step on setting up one of these from scratch. I'm sure many of us would find it useful!
As a small thing to improve, the image in the beginning has a very low resolution, and I simply can't read it :(
Keep up the awesome work!
I will no longer have to nod and smile and hope no one asks any questions whenever the K-word comes up. Thanks
Haha 😂 glad it was helpful for you!
Great post, thanks for sharing. Really valuable information. You inspired me to complete my article about Kubernetes.
Good article. Really simple and straight to the point.
I just wanted to say this is an amazing article and provides a great mental model for Kubernetes! :D
Wow, thank you!
Thanks for sharing this!