This was originally a Stride ⚡️ Lightning Talk⚡️ hosted by the Learning Initiative and presented by Grant Ziolkowski.
What is Kubernetes?
You’ve probably heard about Kubernetes or K8s. It’s kind of a buzzword thrown around with DevOps, containers, and the cloud. But if you have never worked in it, this is going to be a high-level overview of components for one use case. I’d always been curious about Kubernetes, but even knowing how to use it, I had no clue what it was. This article is therefore more about what it actually does, rather than some of the definitions or buzz around it.
The definition of Kubernetes according to the official documentation is as follows:
"Kubernetes is a portable, extensible, open-source platform for managing containerized workloads and services, that facilitates both declarative and configuration and automation."
So, if you’re like me, you still have no clue what that means. I just see buzzwords in there like open-source, automation, and containers, but nothing stands out.
The definition tells you what it is good for, but not what it is.
Let’s talk about the raw components and look at a use case.
Containers offer you the ability to run your app in an isolated environment. This allows you to share your app out, so that someone can pull it down on their machine and run it in the same way that you run it in the cloud. It’s all about having this consistent environment to run your app in.
But I wanted to think about these containers more in terms of Kubernetes, which is about orchestration. It is less about containers and more about multiple containers.
If you think of a container as a musician who knows their runtime and knows how to play the instrument, now we’re talking about a full orchestra of these containers.
So how do they know how to talk to one another, how do these musicians know who to sub out for a gig when someone else is unable to play? Who brings in the new musician and makes sure they are up to speed, without breaking the flow of the orchestra?
It's all about the orchestrator of this band of containers.
Update containers without downtime
The main use case of Kubernetes is updating this band of containers without having any downtime.
Let's say you update your app, you’ve pushed a PR, and it's hooked up to some continuous delivery (CD) pipeline. If the CD is working with Kubernetes, it is declaring that the deployment of the app has new code. Let’s say you’re using a container, and that container would now be in an image that you just pushed to a new registry URL. So your deployment knows that this container has changed. This is where Kubernetes actually happens.
Kubernetes isn’t magic. It's a group of servers and clients that are talking to each other. It's a bunch of components. Since they are components, you can add your own and expand it. These are just instances of virtual machines (VMs), and the idea is to get the container onto the VM. The node is just a VM running somewhere, and the idea is to get the container onto that; that's what a deployment is.
Let's walk through the flow of what Kubernetes does:
- The Kubernetes API is listening for objects in the system to change—for example, your deployment changing.
- Then the Kube Controller, a manager that knows about the current state of your system, is going to try to reconcile that with the desired state, which is your new code.
- Then there is the Kube Scheduler, which knows about the different containers on the node, what resources and space are available, and where to put your container.
- These are all talking to the API server, which bundles your changes, pushes them to your client on your node—called the kubelet—and lets you know the update is coming.
- Then your node is running some networking plugins to let it know if there is allocation available for the network to have your new container.
- Then your container is started, and it’s called a Pod at this point.
- Then the Kube Proxy allows the Pod access to the rest of the containers in the node, and most likely exposes the node through a load balancer, allowing you to ping your app.
- With this communication, it allows you on the outside to talk through the server into the node. This lets you do crucial things such as debugging the app and getting the logs, which is what is so powerful for troubleshooting.
That is the high-level snapshot of Kubernetes. Stay tuned for more on Kubernetes; there may be a “How To” post in the not-too-distant future.
In the meantime, check out these resources for more information on Kubernetes:
- Kubernetes Documentation
- kelseyhightower/kubernetes-the-hard-way: Bootstrap Kubernetes the hard way on Google Cloud Platform. No scripts.
- Kubernetes Essentials from Google Cloud. This is an outstanding five-part introduction from Google on YouTube.
Interested in reading more blog posts like this?
We post about people and culture, engineering, and product every other week. Subscribe for more blog posts like this one!