{"id":22709234,"date":"2023-06-10T07:00:45","date_gmt":"2023-06-10T14:00:45","guid":{"rendered":"https:\/\/thenewstack.io\/?p=22709234"},"modified":"2023-06-06T08:44:43","modified_gmt":"2023-06-06T15:44:43","slug":"deploy-a-kubernetes-development-environment-with-kind","status":"publish","type":"post","link":"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/","title":{"rendered":"Deploy a Kubernetes Development Environment with Kind"},"content":{"rendered":"\n

Let me set the stage: You’re just starting your journey into Kubernetes and you’re thrilled at the idea of developing your first application or service. Your first step is to deploy a Kubernetes cluster so you can start building but almost immediately realize how challenging a task that is.<\/p>\n

All you wanted to do was take those first steps into the world of container development but actually getting Kubernetes up and running in a decent amount of time has proven to be a bit of a challenge<\/a>.<\/p>\n

Would that there was something a bit kinder.<\/p>\n

There is and it’s called kind.<\/p>\n

From the official kind website<\/a>: kind is a tool for running local Kubernetes clusters using Docker container “nodes.” kind was primarily designed for testing Kubernetes itself but may be used for local development or continuous integration.<\/p>\n

Kind is one of the easiest ways of starting out with Kubernetes development, especially if you’re just beginning your work with containers. In just a few minutes you can get kind installed and running, ready for work.<\/p>\n

Let me show you how it’s done.<\/p>\n

What You’ll Need<\/h2>\n

You can install kind on Linux, macOS, and Windows. I’ll demonstrate how to install kind on all three platforms. Before you install kind on your operating system of choice, you will need to have both Docker and Go installed. I’ll demonstrate it on Ubuntu Server 22.04. If you use a different Linux distribution, you’ll need to alter the installation steps accordingly.<\/p>\n

Installing Docker<\/h2>\n

The first thing to do is install Docker. Here’s how on Each OS.<\/p>\n

Linux<\/h3>\n

Log into your Ubuntu instance and access a terminal window. Add the official Docker GPG key with the command:<\/p>\n

curl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg &&\r\n\r\n| sudo gpg --dearmor -o \/usr\/share\/keyrings\/docker-archive-keyring.gpg<\/pre>\n

Add the Docker repository:<\/p>\n

echo \"deb [arch=amd64 signed-by=\/usr\/share\/keyrings\/docker-archive-keyring.gpg] https:\/\/download.docker.com\/linux\/ubuntu $(lsb_release -cs) stable\" | sudo tee \/etc\/apt\/sources.list.d\/docker.list > \/dev\/null<\/pre>\n

Install the necessary dependencies with the command:<\/p>\n

sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release git -y<\/pre>\n

Update apt:<\/p>\n

sudo apt-get update<\/pre>\n

Install the latest version of the Docker CE runtime engine:<\/p>\n

sudo apt-get install docker-ce docker-ce-cli containerd.io -y<\/pre>\n

Add your user to the docker group with the command:<\/p>\n

sudo usermod -aG docker $USER<\/pre>\n

Log out and log back in for the changes to take effect.<\/p>\n

MacOS\/Windows<\/h3>\n

The easiest method of installing Docker on macOS and Windows is by way of Docker Desktop. You can download the installers for macOS Intel<\/a>, macOS Apple Silicon<\/a>, or Windows<\/a>, double-click the files, and walk through the installation wizards.<\/p>\n

Installing Go<\/h2>\n

Next, install Go. Here’s how.<\/p>\n

Ubuntu Linux<\/h3>\n

To install Go on Ubuntu, open a terminal window and issue the command:<\/p>\n

sudo apt-get install golang-go -y<\/pre>\n

MacOS\/Windows<\/h3>\n

To install Go on macOS or Windows, simply download and run the installer file which can be found for macOS Intel<\/a>, macOS Apple Silicon<\/a>, and Windows<\/a>.<\/p>\n

Installing kind<\/h2>\n

Now, we can install kind. Here’s how for each platform.<\/p>\n

Linux<\/h3>\n

Download the binary file with the command:<\/p>\n

curl -Lo .\/kind https:\/\/kind.sigs.k8s.io\/dl\/v0.14.0\/kind-linux-amd64<\/pre>\n

Give the file the necessary permissions with:<\/p>\n

chmod +x kind<\/pre>\n

Move it to \/usr\/bin with:<\/p>\n

sudo mv kind \/usr\/bin\/<\/pre>\n

MacOS<\/h3>\n

Open the terminal application. For macOS Intel, download kind with:<\/p>\n

[ $(uname -m) = x86_64 ]&& curl -Lo .\/kind https:\/\/kind.sigs.k8s.io\/dl\/v0.14.0\/kind-darwin-amd64<\/pre>\n

For Apple Silicon, issue the command:<\/p>\n

[ $(uname -m) = arm64 ] && curl -Lo .\/kind https:\/\/kind.sigs.k8s.io\/dl\/v0.14.0\/kind-darwin-arm64<\/pre>\n

Give the file executable permissions with:<\/p>\n

chmod +x kind<\/pre>\n

Move kind so that it can be run globally with the command:<\/p>\n

mv .\/kind \/usr\/local\/bin\/kind<\/pre>\n

Windows<\/h3>\n

Open the terminal window app. Download kind with:<\/p>\n

curl.exe -Lo kind-windows-amd64.exe https:\/\/kind.sigs.k8s.io\/dl\/v0.14.0\/kind-windows-amd64<\/pre>\n

Move the executable file to the directory of your choice with the command:<\/p>\n

Move-Item .\\kind-windows-amd64.exe c:\\DIRECTORY\\kind.exe<\/pre>\n

Where DIRECTORY is the name of the directory to house kind.<\/p>\n

Create a Dev Environment<\/h2>\n

It’s now time to deploy your first Kubernetes cluster with kind. Let’s create one called tns-test with the command:<\/p>\n

kind create cluster --name=tns-test<\/pre>\n

You should see the following output in the terminal window:<\/p>\n

✓ Ensuring node image (kindest\/node:v1.24.0) 🖼<\/em><\/p>\n

✓ Preparing nodes 📦<\/em><\/p>\n

✓ Writing configuration 📜<\/em><\/p>\n

✓ Starting control-plane 🕹️<\/em><\/p>\n

✓ Installing CNI 🔌<\/em><\/p>\n

✓ Installing StorageClass 💾<\/em><\/p>\n

Once the output completes, you’re ready to go. One thing to keep in mind, however, is that the command only deploys a single node cluster. Say you have to start developing on a multinode cluster. How do you pull that off? First, you would need to delete the single node cluster with the command:<\/p>\n

kind delete cluster --name=tns-test<\/pre>\n

Next, you must create a YML file that contains the information for the nodes. Do this with the command:<\/p>\n

nano kindnodes.yml<\/pre>\n

In that file, paste the following contents:<\/p>\n

kind: Cluster\r\napiVersion: kind.x-k8s.io\/v1alpha4\r\nnodes:\r\n- role: control-plane\r\n- role: worker<\/pre>\n

Save and close the file. You can then deploy with the command:<\/p>\n

kind create cluster --name=tns-multi-test --config=kindnodes.yml<\/pre>\n

To verify your cluster is running, issue the command:<\/p>\n

kind get clusters<\/pre>\n

You should see tns-multi-test<\/em> in the output.<\/p>\n

If you want to interact with kubectl, you first must install it. On Ubuntu, that’s as simple as issuing the command:<\/p>\n

sudo snap install kubectl --classic<\/pre>\n

Once kubectl<\/a> is installed, you can check the cluster info with a command like this:<\/p>\n

kubectl cluster-info --context kind-tns-multi-test<\/pre>\n

You should see something like this in the output:<\/p>\n

Kubernetes control plane is running at https:\/\/127.0.0.1:45465\r\nCoreDNS is running at https:\/\/127.0.0.1:45465\/api\/v1\/namespaces\/kube-system\/services\/kube-dns:dns\/proxy<\/pre>\n

To further debug and diagnose cluster problems, use ‘kubectl cluster-info dump<\/em>‘.<\/p>\n

You can now start developing on a multinode Kubernetes cluster, with full use of the kubectl command.<\/p>\n<\/body><\/html>\n","protected":false},"excerpt":{"rendered":"

Let me set the stage: You’re just starting your journey into Kubernetes and you’re thrilled at the idea of developing<\/p>\n","protected":false},"author":628,"featured_media":22710192,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[10054,9985],"tags":[],"acf":[],"yoast_head":"\nDeploy a Kubernetes Development Environment with Kind - The New Stack<\/title>\n<meta name=\"description\" content=\"Kind is one of the easiest ways of starting out with Kubernetes development, especially if you're just beginning your work with containers.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Deploy a Kubernetes Development Environment with Kind\" \/>\n<meta property=\"og:description\" content=\"Kind is one of the easiest ways of starting out with Kubernetes development, especially if you're just beginning your work with containers.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/\" \/>\n<meta property=\"og:site_name\" content=\"The New Stack\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/thenewstack\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-10T14:00:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-06T15:44:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.thenewstack.io\/media\/2023\/06\/66fd7bb3-kind.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Jack Wallen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@thenewstack\" \/>\n<meta name=\"twitter:site\" content=\"@thenewstack\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jack Wallen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"NewsArticle\",\"@id\":\"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/\"},\"author\":{\"name\":\"Jack Wallen\",\"@id\":\"https:\/\/thenewstack.io\/#\/schema\/person\/2af84030af692a9705c2f4b27df9a943\"},\"headline\":\"Deploy a Kubernetes Development Environment with Kind\",\"datePublished\":\"2023-06-10T14:00:45+00:00\",\"dateModified\":\"2023-06-06T15:44:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/\"},\"wordCount\":752,\"publisher\":{\"@id\":\"https:\/\/thenewstack.io\/#organization\"},\"articleSection\":[\"Containers\",\"Kubernetes\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/\",\"url\":\"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/\",\"name\":\"Deploy a Kubernetes Development Environment with Kind - The New Stack\",\"isPartOf\":{\"@id\":\"https:\/\/thenewstack.io\/#website\"},\"datePublished\":\"2023-06-10T14:00:45+00:00\",\"dateModified\":\"2023-06-06T15:44:43+00:00\",\"description\":\"Kind is one of the easiest ways of starting out with Kubernetes development, especially if you're just beginning your work with containers.\",\"breadcrumb\":{\"@id\":\"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/thenewstack.io\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Deploy a Kubernetes Development Environment with Kind\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/thenewstack.io\/#website\",\"url\":\"https:\/\/thenewstack.io\/\",\"name\":\"The New Stack\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/thenewstack.io\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/thenewstack.io\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/thenewstack.io\/#organization\",\"name\":\"The New Stack\",\"url\":\"https:\/\/thenewstack.io\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/thenewstack.io\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdn.thenewstack.io\/media\/2021\/11\/a9fbec84-the-new-stack-logo-rgb-screen.png\",\"contentUrl\":\"https:\/\/cdn.thenewstack.io\/media\/2021\/11\/a9fbec84-the-new-stack-logo-rgb-screen.png\",\"width\":1032,\"height\":128,\"caption\":\"The New Stack\"},\"image\":{\"@id\":\"https:\/\/thenewstack.io\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/thenewstack\",\"https:\/\/twitter.com\/thenewstack\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/thenewstack.io\/#\/schema\/person\/2af84030af692a9705c2f4b27df9a943\",\"name\":\"Jack Wallen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/thenewstack.io\/#\/schema\/person\/image\/15105800a0270a384212262298083881\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ad516503a11cd5ca435acc9bb6523536?s=96\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ad516503a11cd5ca435acc9bb6523536?s=96\",\"caption\":\"Jack Wallen\"},\"url\":\"https:\/\/thenewstack.io\/author\/jack-wallen\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Deploy a Kubernetes Development Environment with Kind - The New Stack","description":"Kind is one of the easiest ways of starting out with Kubernetes development, especially if you're just beginning your work with containers.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/","og_locale":"en_US","og_type":"article","og_title":"Deploy a Kubernetes Development Environment with Kind","og_description":"Kind is one of the easiest ways of starting out with Kubernetes development, especially if you're just beginning your work with containers.","og_url":"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/","og_site_name":"The New Stack","article_publisher":"https:\/\/www.facebook.com\/thenewstack","article_published_time":"2023-06-10T14:00:45+00:00","article_modified_time":"2023-06-06T15:44:43+00:00","og_image":[{"width":1200,"height":600,"url":"https:\/\/cdn.thenewstack.io\/media\/2023\/06\/66fd7bb3-kind.png","type":"image\/png"}],"author":"Jack Wallen","twitter_card":"summary_large_image","twitter_creator":"@thenewstack","twitter_site":"@thenewstack","twitter_misc":{"Written by":"Jack Wallen","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/#article","isPartOf":{"@id":"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/"},"author":{"name":"Jack Wallen","@id":"https:\/\/thenewstack.io\/#\/schema\/person\/2af84030af692a9705c2f4b27df9a943"},"headline":"Deploy a Kubernetes Development Environment with Kind","datePublished":"2023-06-10T14:00:45+00:00","dateModified":"2023-06-06T15:44:43+00:00","mainEntityOfPage":{"@id":"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/"},"wordCount":752,"publisher":{"@id":"https:\/\/thenewstack.io\/#organization"},"articleSection":["Containers","Kubernetes"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/","url":"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/","name":"Deploy a Kubernetes Development Environment with Kind - The New Stack","isPartOf":{"@id":"https:\/\/thenewstack.io\/#website"},"datePublished":"2023-06-10T14:00:45+00:00","dateModified":"2023-06-06T15:44:43+00:00","description":"Kind is one of the easiest ways of starting out with Kubernetes development, especially if you're just beginning your work with containers.","breadcrumb":{"@id":"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/thenewstack.io\/deploy-a-kubernetes-development-environment-with-kind\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thenewstack.io\/"},{"@type":"ListItem","position":2,"name":"Deploy a Kubernetes Development Environment with Kind"}]},{"@type":"WebSite","@id":"https:\/\/thenewstack.io\/#website","url":"https:\/\/thenewstack.io\/","name":"The New Stack","description":"","publisher":{"@id":"https:\/\/thenewstack.io\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thenewstack.io\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/thenewstack.io\/#organization","name":"The New Stack","url":"https:\/\/thenewstack.io\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/thenewstack.io\/#\/schema\/logo\/image\/","url":"https:\/\/cdn.thenewstack.io\/media\/2021\/11\/a9fbec84-the-new-stack-logo-rgb-screen.png","contentUrl":"https:\/\/cdn.thenewstack.io\/media\/2021\/11\/a9fbec84-the-new-stack-logo-rgb-screen.png","width":1032,"height":128,"caption":"The New Stack"},"image":{"@id":"https:\/\/thenewstack.io\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/thenewstack","https:\/\/twitter.com\/thenewstack"]},{"@type":"Person","@id":"https:\/\/thenewstack.io\/#\/schema\/person\/2af84030af692a9705c2f4b27df9a943","name":"Jack Wallen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/thenewstack.io\/#\/schema\/person\/image\/15105800a0270a384212262298083881","url":"https:\/\/secure.gravatar.com\/avatar\/ad516503a11cd5ca435acc9bb6523536?s=96","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ad516503a11cd5ca435acc9bb6523536?s=96","caption":"Jack Wallen"},"url":"https:\/\/thenewstack.io\/author\/jack-wallen\/"}]}},"_links":{"self":[{"href":"https:\/\/thenewstack.io\/wp-json\/wp\/v2\/posts\/22709234"}],"collection":[{"href":"https:\/\/thenewstack.io\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thenewstack.io\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thenewstack.io\/wp-json\/wp\/v2\/users\/628"}],"replies":[{"embeddable":true,"href":"https:\/\/thenewstack.io\/wp-json\/wp\/v2\/comments?post=22709234"}],"version-history":[{"count":7,"href":"https:\/\/thenewstack.io\/wp-json\/wp\/v2\/posts\/22709234\/revisions"}],"predecessor-version":[{"id":22710251,"href":"https:\/\/thenewstack.io\/wp-json\/wp\/v2\/posts\/22709234\/revisions\/22710251"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thenewstack.io\/wp-json\/wp\/v2\/media\/22710192"}],"wp:attachment":[{"href":"https:\/\/thenewstack.io\/wp-json\/wp\/v2\/media?parent=22709234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thenewstack.io\/wp-json\/wp\/v2\/categories?post=22709234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thenewstack.io\/wp-json\/wp\/v2\/tags?post=22709234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}