Local Kubernetes Cluster

Create a local cluster and install the distribution on top of it

3 minute read

This Quick Start Guide will guide you through the process of creating a local Kubernetes cluster.

Prerequisites

To run this Quick Start guide, you must have a powerful enough computer (Linux or macOS with 4 cores and 16gb memory) with the following software installed:

  • docker: Required because we are going to run Kubernetes In Docker.
  • kind: Creates a local Kubernetes Cluster locally. Required version v0.11.0.
  • kubectl: This Will be used to managing our cluster. Recommended version: 1.19.4

Check your requirements before start:

$ docker version
Client: Docker Engine - Community
 Version:           20.10.2
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        2291f61
 Built:             Mon Dec 28 16:17:43 2020
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.2
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8891c58
  Built:            Mon Dec 28 16:15:19 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
$ kind version
kind v0.11.0 go1.16.4 linux/amd64
$ kubectl version --client
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.4", GitCommit:"d360454c9bcd1634cf4cc52d1867af5491dc9c5f", GitTreeState:"clean", BuildDate:"2020-11-11T13:17:17Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}

If you are not able to meet these system requirements, you can try the AWS alternative.

Hands-on

Let’s define some useful variables:

$ export CLUSTER_DIR="/tmp/sighup.io/cluster"
$ export KFD_VERSION="v1.7.0"
$ export KFD_KIND_CONFIG="kind-kfd-config"
$ export CLUSTER_NAME="kfd-quick-start"
$ export CLUSTER_VERSION="1.19.4"
$ export KUBECONFIG="${CLUSTER_DIR}/config"

Create a local directory where to start:

$ rm -rf ${CLUSTER_DIR}
$ mkdir -p ${CLUSTER_DIR}
$ cd ${CLUSTER_DIR}

Then, download our predifined Kind configuration file:

$ curl -Ls -o ${KFD_KIND_CONFIG} https://github.com/sighupio/fury-distribution/releases/download/${KFD_VERSION}/kind-config-${KFD_VERSION}.yml
$ ls
kind-kfd-config

Now is time to create a brand new local Kubernetes cluster.

$ $ kind create cluster  --name ${CLUSTER_NAME} --config ${KFD_KIND_CONFIG} --image kindest/node:v${CLUSTER_VERSION} --wait 1m
Creating cluster "kfd-quick-start" ...
 ✓ Ensuring node image (kindest/node:v1.19.4) 🖼
 ✓ Preparing nodes 📦 📦
 ✓ Writing configuration 📜
 ✓ Starting control-plane 🕹️
 ✓ Installing StorageClass 💾
 ✓ Joining worker nodes 🚜
 ✗ Waiting ≤ 1m0s for control-plane = Ready ⏳
 • WARNING: Timed out waiting for Ready ⚠️
Set kubectl context to "kind-kfd-quick-start"
You can now use your cluster with:

kubectl cluster-info --context kind-kfd-quick-start

Have a question, bug, or feature request? Let us know! https://kind.sigs.k8s.io/#community 🙂
$ kind get kubeconfig --name="${CLUSTER_NAME}" > config
$ kubectl get nodes
NAME                            STATUS     ROLES    AGE     VERSION
kfd-quick-start-control-plane   NotReady   master   3m52s   v1.19.4
kfd-quick-start-worker          NotReady   <none>   3m17s   v1.19.4

As you can see, the cluster is configured with two nodes in NotReady state. Don’t worry, it’s the expected output. It will be fixed once the distribution got deployed on top of this cluster.

Now that you have a Kubernetes cluster, you deploy the Kubernetes Fury Distribution

Tear down

After finishing this quick start guide, don’t forget to destroy this infrastructure:

$ kind delete cluster --name="${CLUSTER_NAME}"