In this article, we understand what Kubernetes actually is. This article is good for total beginners, you don’t need much prior knowledge to start.
Overview
We’ll try to understand these two questions,
- What are containers?
- What is Kubernetes?
Let’s start with looking at the official docs of Kubernetes,
Kubernetes is a portable, extensible, open-source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.
You might have understood that or might got even more confused as to what actually Kubernetes is š.
If we look at the definition, it says, ...managing containerized workloads and services
. Lets see what these containers are.
What are containers?
Imagine you have developed an app and now when you or ops team deploy on a different machine everything breaks.
Containers essentially solve the āit works on my machineā problem.
A container is a standardized software component that wraps up code and all of its dependencies to ensure that an application will run swiftly and consistently in different computing environments.
Docker containers are one of the most powerful providers which implement containerization.
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.
And finally, What’s Kubernetes?
We now know what containers are. Letās refer to them as Docker Images from now on.
Problemā¦
So now we have our Docker image ready and we are ready to deploy it.
We start by running one instance of our Docker image.
And the command would look something like this (ofcourse you have to create your app’s docker image first,but that’s not in the scope of this article).
docker run -d -p 80:80 --name=my-awesome-app my-apps-image:latest
Now, anyone can access your app by entering your <you-public-ip>:80
Your users can access your app and everything is working smoothly.
Now, lets start with counting the problems that may arrive,
Let’s divide them in 2 broad categories
- Infrastructure problems
- Application problems
Infrastructure Problems
Problems which may occur with your hardware or network.
1) Your server may shut down suddenly, it can happen because of power outage even if its a remote cloud server it actually can go down though chances are rare.
So once it’s down you may need to restart your server. And you may also have to run your docker container image again.
2) Your server ran out of memory.
Whoops, A nightmare. Your app is taking too much resources only during peak hours, and hence your server ran out of memory and it crashes.
3) Network is down
Well if your Internet provider is down your app will go down.
We can see the main problem here that we always have to monitor our server and make sure it’s running. This can be really hard to monitor as we can’t do it 24hrs.
*** We need sleep too***
We need something to automate this. A system which can watch our app at all the time and solve all the scenarios automatically including which we missed here.
Application problem
1) You need to increase your number of instances of application as your users grow. For this we have to manually monitor our application’s load and increase or decrease the number of instances of our app.
2) Quick setup of multiple environments
It’s a must for any developer or team of developers to have multiple versions of app deployed for example: test,dev, feature, release etc.
To handle this you’ll have different configs for each one for example db connection URLs,secrets etc.
It can quickly become hard to manage our containers.
You also need to make sure that you don’t deploy your test containers in the production server.
3) You may deploy buggy app in production by mistake and need to revert it quickly.
The problem in the real world worsens when we go into production, we deploy more than oneĀ instance of our app.
- It’s already really hard to always monitor one instance of our app and re-start our app in case it gets stuck or stops responding as we can’t be online 24*7. Now imagine managing 100s and 1000s of instances šµšµāš«
- Also what if your server crashes? What if it shuts down?Ā you would have to reboot it manually.
Kubernetes
K8s helps in managing your containerized applications and automates your devops process.
Along with this K8s can automate a lot of things like scaling of your app based on load.
In the Upcoming articles weāll go deep into K8s and understand all the features and architecture of it.
Thanks for reading. For more articles like this, visit our site.