Introduction to Kubernetes
Explore the fundamentals of Kubernetes and how it simplifies running applications across many machines by managing resources, replicas, and configurations automatically.
We'll cover the following...
After our application is packaged in a container image somewhere, we need a way to actually run it, and that’s where a system like Kubernetes will help us.
Kubernetes
Kubernetes’ job is to take a group of machines and expose them to us as if it was a single thing. It’s similar to running an application locally; you don’t care which CPU core is executing it or the memory addresses the application is using. We just run the application, and let the operating system take care of the rest. Kubernetes does that at the datacenter level. It doesn’t matter if we have one or one thousand machines available. The way we interact with Kubernetes is the same: we tell it what we want, and it will do its best to make that happen.
The Kubernetes API allows us to declare what we want without having to know exactly how that is going to happen, and that is very powerful.
We will not say: “run one copy of this application in machine A and another in machine B.” Actually, we don’t even need to know what the machines are that are running behind it as people using Kubernetes. We will just say, “I need 2 copies of this application, and it needs 2 cores and 5 GB of memory,” and Kubernetes will find a way to run it.
If the application crashes, Kubernetes can restart it. If one application starts using more resources than you defined as its limit, Kubernetes will make sure this application will not impact other applications running in the same machine. Kubernetes helps us run all our applications smoothly, fixes things when they go wrong and uses the resources we have available in the best way possible.
In addition to that, Kubernetes provides several features that make our lives easier. If we have dozens of replicas of an application running, Kubernetes can load balance the traffic between these replicas. Kubernetes can also help if we need an application to be accessible from outside the cluster. What if we need to provide configurations and secrets to our applications, run one-off tasks, or run tasks on a schedule? Kubernetes can do it all.
In summary, Kubernetes is a platform that makes it easier to run complex systems’ reliably.