Kubernetes for Beginners Part 1
An absolute Kubernetes beginners guide
I first heard the word "Kubernetes" at a tech event. We were supposed to choose which sessions to attend.
The term "Kubernetes" seemed intimidating. I didn't even dare pronounce it. I didn't even know how to, anyway. That was in 2019.
Fast forward to 2022 and I came across it again. This time, there was no running away. I needed to understand it so that I could deliver at work.
Well, if you are like me, don't worry. It's not as bad as you think. I will do my best to walk you through Kubernetes.
First, to understand Kubernetes, there are some concepts you need to know.
Prerequisite Concepts
Local Deployment
If you are a beginner web developer, you have probably worked with localhost or 127.0.0.1 to serve some content or work with some requests, for example, a GET HTTP request.
In other words, you have worked with a local server.
Deploying your application locally means displaying content on your computer via localhost and a port number, for example, http://localhost:3000/
Your application files are only available on your computer. No one else has access to them.
On-prem
With on-prem (on-premises), you have a physical server to which you deploy your application.
The application is therefore accessible via another device, even outside your organization.
With on-prem, the number of concurrent requests can easily overwhelm your server.
In order to accommodate the increased requests, you must add more servers. This is known as "horizontal scaling."
You might also need to increase your server’s capacity, for example, by adding RAM. This is known as "vertical scaling."
Cloud Deployment
In the last two scenarios, for you to handle more requests, you have to increase server capacity or the number of servers yourself.
However, there is an option to do this without much work from your side—cloud deployment.
With the cloud, you deploy your application to servers that are owned by someone else, usually a vendor like Amazon Web Services (AWS).
The vendor is therefore responsible for both horizontal and vertical scaling. And like with on-prem, your app is also accessible to people outside your organization.
Vendors like AWS are called "public cloud vendors." This is where you “rent” server space on a public server.
You then have a slot that is assigned to you.
It’s more like living in an apartment. You have rented your own space, but there are other people in the building too.
You all have different apartments, though.
Public cloud vendors also provide private servers—VPCs (virtual private clouds). With VPCs, some resources are reserved, making them more available should you need them.
So, we have public cloud deployments and private cloud deployments.
With the deployment options out of the way, we can now delve into Kubernetes.
What is Kubernetes?
Kubernetes (K8s) is usually defined as a container orchestration service.
However, we are keeping things simple here.
Kubernetes is simply a tool to manage containers.
Now, what are containers?
Containers
Let's go back to the different types of deployments above—local, on-prem, and cloud.
If someone else, let’s say a fellow developer, wanted to have your code files, they would need to get their own “copy”.
They would need to go to GitHub, for example, and clone your project files. They would then install any dependencies needed to make the code run smoothly.
This, however, might not be the case. There could be some configurations on their computer that might make it very difficult for the code to run as expected.
Putting the code in a container, however, ensures that the code runs the same way, in spite of the environment.
Containers are predefined configurations and dependencies, along with the code files that make it possible for the code to run seamlessly.
It’s like having code that you can literally plug in and it runs right out of the box.
Kubernetes comes in to manage these containers. It takes care of resource and workload distribution as well as scaling.
The Kubernetes Cluster
The Kubernetes cluster refers to the components that work together to manage containers.
There are two main components in K8s that work in tandem:
Master nodes
Worker nodes
Master nodes
This is the component responsible for all the critical processes that run within the K8s cluster. A K8s cluster can work with only one node, but there can be multiple ones if the other one fails.
Worker nodes
These are the components responsible for communication within the cluster. They also ensure that tasks are executed.
Final Thoughts
We have explored some basic concepts you need to understand for you to get started with Kubernetes. I hope this becomes a solid foundation for you.
In Part 2, we will do a deep dive into the Kubernetes cluster and the two types of nodes—master nodes and worker nodes.
Last updated