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:
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
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 kubectl
from 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!
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](https://kubernetes.io/examples/application/cassandra/cassandra-service.yaml)
and [cassandra-statefulset.yaml](https://kubernetes.io/examples/application/cassandra/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 ./
#cloud #tutorial #docker #kubernetes #serverless #kind