Skip to content
Home ยป Kubernetes 101: How to Deploy Kubernetes with Kind

Kubernetes 101: How to Deploy Kubernetes with Kind

Welcome to the first chapter of my free Kubernetes crash course, Kubernetes 101: How to Deploy Kubernetes with Kind!

This chapter will walk you through the simple steps to deploy Kubernetes with Kind and Docker!

As mentioned in my previous post, I believe that the best way to learn is simply by doing. With that said, my free course on learning Kubernetes will be paired with practical walk-throughs that anyone can follow along with. While I still plan on explaining Kubernetes concepts throughout my course, you will develop a stronger understanding if you follow the practical steps alongside your learning. I cannot recommend it enough!

One important note I would like to mention is that throughout my Kubernetes course, Kubernetes 101, I will not be covering additional steps required for Windows users to follow along the practical walk-throughs. This course will cover steps for Mac and Linux users.

Using Docker and Kind to Deploy Kubernetes on your computer

Configuring and deploying Kubernetes is not only complex, it’s expensive. Well, unless you plan to deploy Kubernetes on your local machine of course! Instead of deploying Kubernetes with a managed service provider and potentially racking up hundreds of dollars in cloud costs in our first week, we have the luxury of deploying Kubernetes locally! Introducing Kind.

Kind lets you deploy a Kubernetes cluster on your local computer by using Docker containers as your Kubernetes cluster nodes. Kind allows you to learn and test Kubernetes freely on your machine which is absolutely awesome!

Before we can starting learning about Kubernetes and all of its glory, we have some installing to do.

How to install Docker Desktop

As previously mentioned, Kind uses Docker containers as your Kubernetes cluster nodes so you could imagine why Docker is required to get this ball rolling. Installing Docker Desktop is a simple process that only requires a little bit of time. This is a requirement to easily deploy Kubernetes on your computer.

All you have to do is hop on over to this Docker document, select your operating system, and download. Depending on your operating system there may be some additional steps beyond just clicking a download button but their page will have everything you need.

How to install Kind

If you’re using MacOS then you’re likely using Homebrew as your package manager. If you’re not, I highly recommend you start doing so.

Via Homebrew on MacOS, install Kind:

brew install kind

From release binaries on MacOS, install Kind:

# for Intel Macs
[ $(uname -m) = x86_64 ]&& curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.18.0/kind-darwin-amd64
# for M1 / ARM Macs
[ $(uname -m) = arm64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.18.0/kind-darwin-arm64
chmod +x ./kind
mv ./kind /some-dir-in-your-PATH/kind

Install Kind on Linux from release binaries:

curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.18.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind

Deploy Kubernetes cluster with Kind

Deploying a Kubernetes cluster with Kind is extremely simple. Before running the following command, make sure that Docker Desktop is installed and running on your machine.

kind create cluster

This will bootstrap a Kubernetes cluster using a pre-built node image. Shortly after running the command, Kind will deploy all required Kubernetes components for you to interact with your cluster. You can get all the info about your cluster by running the following command.

kubectl cluster-info --context kind-kind

Interacting with your Kubernetes cluster with kubectl

The Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs. Kubectl is the standard command line tool used to communicate with your Kubernetes clusters. Throughout your Kubernetes journey, you will be using kubectl a lot!

Via Homebrew on MacOS, install kubectl:

brew install kubectl

From release binaries on MacOS, install kubectl:

# for Intel Macs
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"
# for M1 / ARM Macs
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl"

Install kubectl on Linux from release binaries:

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

To ensure that you have kubectl installed correctly, run the following command to display the kubectl version.

kubectl version --client

Let’s now run a kubectl command to display all of the namespaces that were deployed with our Kubernetes cluster!

Get namespaces deployed with our Kubernetes cluster using kubectl.

Very cool! We have some of the default namespaces that are almost always deployed with Kubernetes: default, kube-node-lease, kube-public, and kube-system. We also have a namespace that is native to Kind: local-path-storage.

You already deployed a Kubernetes cluster!

As awesome as you are, let’s not get too ahead of ourselves. This chapter focused on getting a Kubernetes cluster up and running with Kind and while you successfully got that done, there is still a lot to learn before we can start actually using Kubernetes. So exciting!

You can visit the next chapter of Kubernetes 101 here:

Kubernetes 101: Container and Kubernetes Overview

You can visit the previous chapter of Kubernetes 101 here:

Kubernetes 101: Introduction and Prerequisites

Thanks for reading! <3

Leave a Reply

Your email address will not be published. Required fields are marked *