Gaming industry under DDoS attack. Get DDoS protection now. Start onboarding
  1. Home
  2. Developers
  3. Local Kubernetes testing with KIND

Local Kubernetes testing with KIND

  • By Gcore
  • April 9, 2023
  • 2 min read
Local Kubernetes testing with KIND

Intro

If you’ve spent days (or even weeks?) trying to spin up a Kubernetes cluster for learning purposes or to test your application, then your worries are over. Spawned from a Kubernetes Special Interest Group, KIND is a tool that provisions a Kubernetes cluster running IN Docker.

From the docs:

kind is a tool for running local Kubernetes clusters using Docker container “nodes”.
kind is primarily designed for testing Kubernetes 1.11+, initially targeting the conformance tests.

Installing KIND

As it is built using go, you will need to make sure you have the latest version of golang installed on your machine.

According to the k8s docs, golang -v 1.11.5 is preferred. To install kind, run these commands (it takes a while):

go get -u sigs.k8s.io/kindkind create cluster

Then confirm kind cluster is available:

kind get clusters

Setting up kubectl

Also, install the latest kubernetes-cli using Homebrew or Chocolatey.
The latest Docker has Kubernetes feature but it may come with older kubectl . Check its version by running this command:

kubectl version

Make sure it shows GitVersion: "v1.14.1" or above.
If you find you are running kubectlfrom Docker, try brew link or reorder path environment variable.

Once kubectl and kind are ready, open bash console and run these commands:

export KUBECONFIG="$(kind get kubeconfig-path)"kubectl cluster-info

If kind is properly set up, some information will be shown.
Now you are ready to proceed. Yay!

Deploying first application

What should we deploy on the cluster? We are going to attempt deploying Cassandra since the docs have a pretty decent walk-through on it.

First of all, download cassandra-service.yaml and cassandra-statefulset.yaml for later. Then create kustomization.yaml by running two cat commands.
Once those yaml files are prepared, layout them as following:

k8s-wp/  kustomization.yaml  mysql-deployment.yaml  wordpress-deployment.yaml

Then apply them to your cluster:

cd k8s-wpkubectl apply -k ./

Validating (optional)

Get the Cassandra Service.

kubectl get svc cassandra

The response is:

NAME        TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGEcassandra   ClusterIP   None         <none>        9042/TCP   45s

Note that Service creation might have failed if anything else is returned. Read Debug Services for common issues.

Finishing up

That’s really all you need to know to get started with KIND, we hope this makes your life a little easier and lets you play with Kubernetes a little bit more.

Discover more with Gcore Managed Kubernetes

Related articles

What's the difference between multi-cloud and hybrid cloud?

Multi-cloud and hybrid cloud represent two distinct approaches to distributed computing architecture that build upon the foundation of cloud computing to help organizations improve their IT infrastructure.Multi-cloud environments involve us

What is multi-cloud? Strategy, benefits, and best practices

Multi-cloud is a cloud usage model where an organization utilizes public cloud services from two or more cloud service providers, often combining public, private, and hybrid clouds, as well as different service models, such as Infrastructur

What is cloud migration? Benefits, strategy, and best practices

Cloud migration is the process of transferring digital assets, such as data, applications, and IT resources, from on-premises data centers to cloud platforms, including public, private, hybrid, or multi-cloud environments. Organizations can

What is a private cloud? Benefits, use cases, and implementation

A private cloud is a cloud computing environment dedicated exclusively to a single organization, providing a single-tenant infrastructure that improves security, control, and customization compared to public clouds.Private cloud environment

What is a cloud GPU? Definition, types, and benefits

A cloud GPU is a remotely rented graphics processing unit hosted in a cloud provider's data center, accessible over the internet via APIs or virtual machines. These virtualized resources allow users to access powerful computing capabilities

What is cloud networking: benefits, components, and implementation strategies

Cloud networking is the use and management of network resources, including hardware and software, hosted on public or private cloud infrastructures rather than on-premises equipment. Over 90% of enterprises are expected to adopt cloud netwo

Subscribe to our newsletter

Get the latest industry trends, exclusive insights, and Gcore updates delivered straight to your inbox.