What is Kubernetes? | Kubernetes Tutorial
• stackchief •
Kubernetes is a platform for managing containerized workloads. A containerized workload is a process, service, or application running inside a container. A container is a lightweight version of a virtual machine (VM).
What's a VM?
A VM shares a physical host with other VMs. Virtualization is a fancy way of saying "take this computer and make it 5 computers." When you create a VM, you take a portion of a physical machine's resources (CPU, RAM) and create an isolated environment having it's own operating system (OS), filesystem, CPU, and memory.
Why use a VM?
So why use a VM? Why not just run multiple applications on a single OS? It's not like your PC requires a separate OS for each application it runs.
VMs are better for several reasons. VMs can be more secure. Information can't be easily shared across applications having their own OS and virtualized filesystem. Also if an app crashes it won't bring other apps down with it.
This isolation also prevents applications from exhausting shared resources. Without a VM, applications taking up too much memory can starve other applications of these resources. With a VM, applications stay isolated and run within their allocated boundaries.
Using VMs also makes it easier to deploy and scale applications. Applications are more portable and easier to add and update when run inside VMs.
What's a container?
Containers are the next step in the evolution of VMs. Containers provide the same isolated environments as traditional VMs with a few key differences...
Unlike a VM, a container shares the same OS as other containers. This reduces the overhead cost of managing different OS instances across different VMs. Specifically, a hypervisor is no longer needed to manage the communication between these virtualized OS and the physical host.
Containers are more portable than VMs. They run consistently across different environments. A containerized application runs the same on your laptop as it does in the cloud.
Containers are application centric. They are managed as application running on a single OS. VMs are hardware centric as OS instances are managed on virtualized hardware.
Containers and Docker
Docker is an interface for stopping / starting containers. Kubernetes uses Docker as the default interface for managing containerized workloads.
While Docker is the default container runtime interface (CRI) used with Kubernetes, other CRIs do exist and can be used as alternatives to Docker.
For more on Docker and it's relationship with Kubernetes see Kubernetes vs Docker.
In a nutshell, containers are just more efficient than VMs. They achieve the same benefits of VMs (isolated environment, filesystem, resources) more efficiently (running on single OS, sharing common libraries).
So where does Kubernetes come in?
Containers sound great...but where does Kubernetes come in?
Kubernetes provides a platform for managing containerized workloads. Using Kubernetes, you can run containers with zero downtime...
Kubernetes facilitates load balancing and self healing with containers. It can load balance traffic over multiple instances of a container and restart/replace containers when they go down.
Kubernetes is self healing. It can autoscale containers based on the resources they require.
Kubernetes provides the system for running containers efficiently and reliably.
Is Kubernetes free?
Kubernetes is open source meaning you can use it and modify it for free. With that said, IT vendors like AWS and GCP will offer paid plans for running Kubernetes on their infrastructure as a service (IaaS) platforms.