DevOps Tools 101 is a series of posts outlining in easy to digest form, the tools available and in use by the DevOps community.
Today we’ll be learning about Kubernetes (often abbreviated to k8s), which was originally developed and then open-sourced by Google.
The Official Description
From kubernetes.io
Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.
The Breakdown
open-source system
- you can look at and modify the underlying code that makes up kubernetes
containerized applications
- applications that have been made to run in containers
automating deployment, scaling, and management
- takes care of deploying the application, scaling it up and down, and managing the lifecycle (starting, stopping, deleting)
The Explanation
At the heart of it, kubernetes is a container orchestration tool that makes running containerized applications easy.
It does this by using a container runtime (the most popular one right now being Docker) and manifest files that describe the desired state of your application. It will create and delete containers until it reaches this state.
Containerized Applications
Containerized apps are a fancy way of saying that an entire application has been contained into one portable file known as a container image. This image is a blueprint for the application and describes everything in it: the executable, dependencies it relies on, and anything else required by the application. This is what we store in a repository or registry; it’s the artifact of our application.
This image is then used by the container runtime to create a container; a running instantiation of the image. Depending on what kind of application we have, we could potentially interact with it at this point.
If you want to read more about containers and their benefits, Google has a pretty good post on them.
Orchestration
Kubernetes is what’s known as a declarative tool: you give it a desired state and it works to maintain it.
Instead of going the imperative way (do this, then that) and saying “hey kubernetes, create 5 instances of my application now” then 10 minutes later saying “alright, 2 of them aren’t responding, replace them”, you say “I know you’re smart kubernetes, I want 5 instances of this container at all times, make it happen”.
It then orchestrates the creation, destruction, and overall lifecycle of the containers without any more intervention from you.
The Deployment
Kubernetes handles containers via a high level construct known as a deployment. This manifest file outlines the specification of our application with things like the image name and registry location, any port numbers to expose, and the number of instances we’d like to have.
This spec contained in the deployment is known as a Pod spec. Pods are the smallest logical unit in kubernetes and can be thought of as a wrapper around our container(s).
We don’t generally manage the pods themselves as that would be taking the orchestration part away from kubernetes. Instead, we describe the desired state in the deployment and let kubernetes do the rest.
The Alternatives
Many people are working to solve the same problems which means that each problem will more than likely have a multitude of available solutions. Here are a few competing products to Kubernetes.