DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Building Scalable Real-Time Apps with AstraDB and Vaadin
Register Now

Trending

  • Comparing Cloud Hosting vs. Self Hosting
  • Is Podman a Drop-in Replacement for Docker?
  • Competing Consumers With Spring Boot and Hazelcast
  • Microservices With Apache Camel and Quarkus

Trending

  • Comparing Cloud Hosting vs. Self Hosting
  • Is Podman a Drop-in Replacement for Docker?
  • Competing Consumers With Spring Boot and Hazelcast
  • Microservices With Apache Camel and Quarkus
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Local Kubernetes Testing With KIND

Local Kubernetes Testing With KIND

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.

Sudip Sengupta user avatar by
Sudip Sengupta
CORE ·
Aug. 03, 20 · Tutorial
Like (4)
Save
Tweet
Share
4.21K Views

Join the DZone community and get the full member experience.

Join For Free

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/kind kind 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 walkthrough 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-wp kubectl apply -k ./

Validating (Optional)

Get the Cassandra Service.

kubectl get svc cassandra

The response is:

Plain Text
 




x


 
1
NAME        TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGE cassandra   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, I hope this makes your life a little easier and lets you play with Kubernetes a little bit more.

Kubernetes Docker (software)

Published at DZone with permission of Sudip Sengupta. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Comparing Cloud Hosting vs. Self Hosting
  • Is Podman a Drop-in Replacement for Docker?
  • Competing Consumers With Spring Boot and Hazelcast
  • Microservices With Apache Camel and Quarkus

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: