Check out a free preview of the full Complete Intro to Containers, v2 course
The "Kubernetes" Lesson is part of the full, Complete Intro to Containers, v2 course featured in this preview video. Here's what you'd learn in this lesson:
Brian introduces Kubernetes, an open-source system for automating containerized application deployment, scaling, and management. Some fundamental concepts are explained, such as control planes, nodes, pods, services, and deployments. The kubectr installation process is also discussed.
Transcript from the "Kubernetes" Lesson
[00:00:00]
>> Brian Holt: Everything that I've taught you in this course so far could be construed as useful as on a day to day for a developer. And I'm gonna throw out there that it's a relatively simple as a hardware to throw out there, cuz it's still kind of like networking and hard stuff.
[00:00:23]
And particularly if this is your first exposure to it, it should feel hard. But I'm gonna say that Kubernetes is the next level up in terms of difficulty, there's so many moving parts here and it is built for Google scale kind of stuff, right? Whereas everything that we've been using so far is mostly oriented towards individual developers, individual containers and all that kind of stuff.
[00:00:45]
So, what I'm really trying to say here is I'm giving permission for you to feel like this is hard and kind of unapproachable. But I wanted to kind of give you the first step into it, so you understand this is a container, this is Docker-composed of small clusters, and then this is Kubernetes, and this is large clusters.
[00:01:07]
Cuz I imagine many of you're probably using Kubernetes at work, or your work uses Kubernetes, mine does. So, let's talk about use cases of what you would use Kubernetes, and when you would kinda wanna start heading that way. One thing I'll throw out here really quickly, just in general, I'm trying to demystify Kubernetes for all of you so that it just feels a little bit more like something you can talk about.
[00:01:34]
You'll see it all the time abbreviated as k8s or k8s as people sometimes say it loud. That is because some people have a hard time spelling the Greek word Kubernetes. It is k, then it is eight letters, and then s, which is where k8s comes from, just like accessibility is a11y, right, it's 11 letters there.
[00:01:57]
I18n, right, internationalization, I'm sure there's more. So, that's why you'll see that abbreviated as k8s there. Let's go over a few of the just the fundamental concepts here, there is a control plane in Kubernetes. This is what coordinates this scale up, this scale down, this crashed, restart this, it's the brain of your cluster.
[00:02:25]
A lot of the cloud providers don't give away the control plane that they don't charge you for it. If I remember correctly, Azure and Google give it away for free. And they don't charge you for the compute that it incurs to run the control plane. If I remember correctly, elastic Kubernetes service, which is the AWS-1, still charges you for it.
[00:02:50]
You'll sometimes in old pld notes, it's referred to as the master node. But they have since changed the terminology, we've eliminated master from the vernacular of the internet there, so they now call that the control plane.
>> Brian Holt: Nodes, not to be confused with Node.JS, which I recognize that could be confusing in particular in a course like this, are the individual workers.
[00:03:18]
Whatever that worker ends up being, whether that's a server, whether that's a container or whatever that is. One node can be one node and technically can be multiple containers as well.
>> Brian Holt: Frequently you'll see a one-to-one node to a machine, especially if you're training LLMs or something like that, you'll see that that's frequently the case.
[00:03:42]
Yeah, a node is just a deploy target, that's probably the simplest and most accurate way to think of a node is. It's whatever you're deploying to, which is usually a VM of some variety.
>> Brian Holt: Then you have this concept of a pod, a pod is a group of nodes.
[00:04:00]
You kinda wanna think of that as like a inseparable atom or molecule like our app that I just showed you, you cannot run the API without the database. Those two have to be together or they won't run, right? So, you'll deploy them as a pod, it's basically something that you cannot separate.
[00:04:21]
I guess in this particular case, you really could separate them into separate pods, right? And then just have them communicate over, so maybe a better way of thinking about it in that case. I have people seen to do it that way, but it'd be more like I have an app and a sidecar that the sidecar cannot operate without the main app running.
[00:04:43]
And so, you have to deploy those two things together or things just do not work, right? That would be a pod that you would deploy together, yeah, and so scratch what I said about databases, you actually do wanna deploy those as separate pods, because pods will scale together, right?
[00:05:01]
Whereas like you want your Mongo service and your other service to scale independently. So, service speaking of that is a group of pods that make up one back-end, right, or one frontend, right? If you're thinking about micro services or micro service maps to what a service is right?
[00:05:19]
So, a backend, a frontend, a data science service, all those kinds of things will scale as services. And then this all ladders up into a deployment, which is a holistically, I'm pushing an entire new set of services out, right? And then when I'm ready to deployment again, I will roll out another whole deployment.
[00:05:42]
Probably not the best explanation of this or maybe I'm trying to keep this like simple and approachable. And otherwise, like these are tools that you can choose to use to build your service or your system however you want to, right? But it's always made up of these things, nodes into pods, pods into services, services into deployments.
[00:06:05]
There's certainly more to these things than what I've explained to you here, but that's kind of the basic gist of what they should be.
>> Brian Holt: All right, if you are on Windows at the moment, this is harder to get running on Windows, so good luck. I'm gonna show you how to do all this stuff in on Mac, it works on Linux obviously, as you might tell, Kubernetes is strongly geared towards Linux.
[00:06:30]
We're gonna need one new CLI here, which is cube control, I also hear people refer to this as cube cuddle, which I just think is adorable. But this is just a client to control some sort of Kubernetes instance.
>> Brian Holt: So, you can use kubectl to control your AWS instances.
[00:06:54]
You can use it to control your Azure ones, you can use it to control minikube, which is something that runs locally on your computer. We're gonna do it through Kubernetes, through Docker Desktop, which has Kubernetes built into it, but you can see it's just a control client. It didn't have its self-cube, control doesn't actually have Kubernetes built into it, it's just is an API to control some other instance of Kubernetes.
[00:07:25]
>> Brian Holt: So yeah, I mentioned this, we're gonna do it through Docker Desktop, but you can also use minikube if that's what you desire to do. And you can have both installed by the way, you can switch, using what's called context, so you say kubectl config use-context minikube. Docker desktop, and you can switch back and forth, use Azure, use AWS, blah, blah, blah.
[00:07:47]
If you're gonna do minikube, say minikube start, otherwise, I'm gonna show you how to set this up with Docker desktop. So, open docker-desktop, which I have opened here, click on the gear here in the top right. Click on Kubernetes here, I have all this taken down inside of my notes as well.
[00:08:06]
And then just make sure you have enabled Kubernetes. Once you've done that, you will have Kubernetes running on your computer, you'll probably have to say apply and restart which might take a second. Okay, and then you should see up your eyes, you can see I have Docker-desktop is running and Kubernetes is running.
[00:08:25]
Okay, I have kubectl installed, so you should be able to say cluster info.
>> Brian Holt: If you don't, do I have notes here on how to install kubectl? I think I just got it from Homebrew.
>> Brian Holt: Install MacOS.
>> Brian Holt: Yeah, I just installed it through Homebrew. So, I do have that in my notes here as well, so that will be up here, I'll see how to install.
[00:08:58]
It takes you to the ZOC's, MacOS, and I have Apple silicon. You can do it either through Curl, I might have done it that way, right there, that's how I did it, Brew, install, kubectl.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops