Check out a free preview of the full Complete Intro to Containers (feat. Docker) course

The "Kubernetes & kubectl" Lesson is part of the full, Complete Intro to Containers (feat. Docker) course featured in this preview video. Here's what you'd learn in this lesson:

Brian demonstates how to interact with Kubernetes, explains that using Kubernetes is a complex task that generally happens during production, and demonstrates how to use kubectl. Kubectl is a command line interface that manages a Kubernetes cluster.

Preview
Close

Transcript from the "Kubernetes & kubectl" Lesson

[00:00:00]
>> That is like the whirlwind oversimplified version of the terminology associated with Kubernetes. I am skipping a lot of things here as well. So here's the kind of the sad thing, doing this within the Windows subsystem for Linux is basically impossible right now. It's not something that the Windows team has focused on yet, it is coming.

[00:00:23]
So don't try and do this within WSL at the moment. Or you can go look it up and see if it's been fixed right now, but today at this moment, with WSL, it's basically impossible. So if you're doing this alongside with here in Windows, either to open Ubuntu VM and try this or just grab a coffee and enjoy the journey [LAUGH].

[00:00:46]
All right, so we're gonna do a very, very basic interaction with Kubernetes. So I'm gonna show you up here, where's my Docker? So I have my Docker whale right there and there is a tab here for Kubernetes, and you can switch contexts. I have two context and so you likely will just have one which is Docker Desktop.

[00:01:16]
But there's another one called Minikube that you can run as well. If you're in Linux, you'll need to use Minikube, and it's basically like a control structure for Kubernetes. But we're gonna have Docker Desktop running for us on Mac OS so make sure that it's done that and then I want you to enable the local cluster.

[00:01:36]
If it's not already enabled, some of you will probably will have it already enabled. And you can see up here I have Kubernetes is starting, and then we're gonna go over here to our Docker Desktop. You can see here my prompt actually already shows me that I'm using Docker Desktop.

[00:01:55]
But if I switched it to, come back over here, I could switch to Minikube just like that, and if I hit Enter, you'll see that it switches here to Minikube. Let us go back to Docker Desktop. All right, so the next thing I need you to install is kube control or kube cuddle, it depends on who you ask of how you pronounce it, which is this.

[00:02:26]
It obviously means kube control, but people like to say that is kube cuddle. So you can click here for instructions on how to install in your operating system. For Mac OS, you can just do this curl command right here. And then you make it executable, and then you move it into your path.

[00:02:49]
So I already have it installed but again, just do this. Copy that, it will be a curl command, so I'll come over here and say that, oops. Okay, so you'd do that first, then you'd do a chmod, this makes it executable, so you do chmod + x, that makes it an executable.

[00:03:18]
And then you're gonna move this from wherever that is into your local bin, or somewhere that's gonna be in your path. So at some point, you should be able to say kubectl --version. Or is it just version? There you go. So that's what I'm running right now. Okay, and again here I say that you can make a choice between using Docker Desktop.

[00:03:56]
If you're on a Mac, and everything's working fine, then I would just suggest using Docker Desktop because it works, it's already installed. But if you're on Linux, you have to use Minikube, so you're gonna have to go through the Minikube installation process. I think I got it through Brew, if I remember it correctly.

[00:04:20]
Yep, so I have a link there to install it as well. So here down in Minikube, see here for how to install, Mac OS, Installing Minikube, you should have virtualization already running, because we've been doing Docker. All this stuff should work, so yeah, this is what it is, brew install minikube right there.

[00:04:51]
Now if you're on Windows, you probably can get this stuff running via PowerShell. Again, I just don't know PowerShell, so that's left to you, so if you have both installed like me, you can say, kubectl config use-context. And you can switch between them by saying, minikube or you can say docker-desktop.

[00:05:16]
So if I said minikube right now, you can see now it says minikube and I can go back to docker-desktop like that. Again, I'm sticking with docker-desktop. If you're using Minikube, you have to say minikube start as well. Okay, so that has gotten everything running with Kubernetes. It should be executing now on your computer, so let's go ahead and get into this, now, Normally, what you would do is you would define each one of your services with their own Kubernetes YAML files that define, it needs this, it needs that.

[00:05:56]
It needs a bunch of different stuff, it's a lot of setup. It's pretty involved understanding all the various different configuration knobs and stuff like that.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now