From the course: Debugging Kubernetes

Creating clusters with kind - Kubernetes Tutorial

From the course: Debugging Kubernetes

Creating clusters with kind

- [Instructor] Now that we've installed kind, let's talk about how we'll be creating Kubernetes clusters in this course. Before we begin, make sure that you're in the 02_04_before folder in your exercise files bundle like shown here. Once you're here, run ls to see the files that are in this folder. You should see several files. These are going to be files that you'll see throughout the course. Most of the troubleshooting scenarios that we'll work through will have one or more of these files in their exercise bundles. App.yaml describes Kubernetes resources that will be created within the video. Most videos will only have one app.yaml file in their exercise files folders, but there might be more depending on the kind of problem that we're solving. Cluster.yaml is a file that describes a kind cluster that the resources in app.yaml will be deployed into. Some exercise files will also have a file called start_cluster.sh. This is a script that sets up your cluster, along with some additional resources needed for the troubleshooting scenario. I'll guide you through running the script when we see it. Now, there are two ways that we are going to be creating clusters within this course. The first way is by running kind create cluster --name. These series of kind commands simply create a cluster with whatever name we decide to give it. We'll be using the name kind throughout this course. Walking through the process of how this cluster is going to get created, the first thing that's going to happen is kind will retrieve the container image that contains all of the Kubernetes binaries in a way that allows them to be run within Docker. Next, kind will create the containers that are going to be part of our cluster, and then it'll configure that cluster so that we could do something like kubectl get nodes. The next way that we'll be creating clusters is by running start_cluster.sh. Again, I'll guide you through running the script within the videos where we'll use it. Now, you might see an error like this when you try to create a cluster. If you do, then that means that you already have a cluster name kind running within your machine. So all you have to do is run kind delete cluster --name kind to remove the previous cluster, and then run that command again to recreate it. As we saw earlier, some exercise files will have a cluster.yaml file. If that's the case, all you have to do is run kind create cluster --config cluster.yaml. And now we'll do the same thing as we saw before when we ran kind create cluster --name kind. Now, once your cluster's ready, you can run kubectl commands like any other Kubernetes cluster, like get pods or get nodes, like you saw earlier. Now, as mentioned earlier, many of our exercise files will have an app.yaml file that contains Kubernetes resources that we'll be deploying. To deploy them, simply run kubectl apply -f app.yaml. And as you can see, in this case we deployed a pod, a deployment into services. Once you're done with the series of troubleshooting scenarios, you'll be asked to delete the cluster. To delete it, all you have to do is run kind delete cluster --name kind like you saw earlier. If you have a stop_cluster.sh script, you'll be running that instead. But again, I'll guide you through that when the time comes. All right. That is what the exercise files will look like for this course. We're ready to troubleshoot some broken Kubernetes stuff. Let's go.

Contents