Local Kubernetes Cluster

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

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.8.1.
  • kubectl: Will be used to managing our cluster. Recommended version: 1.16.9

Check your requirements before start:

$ docker version
Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea
 Built:             Wed Nov 13 07:22:34 2019
 OS/Arch:           darwin/amd64
 Experimental:      false
$ kind version
kind v0.8.1 go1.13.6 darwin/amd64
$ kubectl version --client
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.9", GitCommit:"a17149e1a189050796ced469dbd78d380f2ed5ef", GitTreeState:"clean", BuildDate:"2020-04-16T11:44:51Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"darwin/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.3.0"
$ export KFD_KIND_CONFIG="kind-kfd-config"
$ export CLUSTER_NAME="kfd-quick-start"
$ export CLUSTER_VERSION="1.16.9"
$ 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://raw.githubusercontent.com/sighupio/fury-distribution/${KFD_VERSION}/katalog/tests/config/kind-config-custom
$ 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.16.9) đŸ–ŧ
 ✓ 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

Thanks for using kind! 😊
$ kind get kubeconfig --name="${CLUSTER_NAME}" > config
$ kubectl get nodes
NAME                            STATUS     ROLES    AGE     VERSION
kfd-quick-start-control-plane   NotReady   master   2m55s   v1.16.9
kfd-quick-start-worker          NotReady   <none>   2m19s   v1.16.9

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}"