Step 2 of 9, about 1 min
Get a cluster ready
A cluster with three workers, kubectl and Helm, and the namespace and password every later step uses.
- A Kubernetes cluster with at least three worker nodes. Sentinel and Cluster spread their pods across nodes so one failure can't take out a majority. Cluster mode wants six pods, so it works best with six nodes, but three will do.
kubectlconnected to it, and Helm 3.8 or later (foroci://charts) if you use the Helm tabs.- About 20 minutes.
No spare machines? kind (Kubernetes in Docker) runs a whole cluster on one computer, each node a Docker container. It's free, and it's what Kubernetes itself is tested with. You need Docker running, with about 8 GB of memory for it.
#Install kind and Helm
bash
winget install Kubernetes.kind
winget install Helm.HelmDocker Desktop with WSL 2 takes its memory limit from %UserProfile%\.wslconfig. Set memory=8GB there, run wsl --shutdown, and start Docker Desktop again.
#Describe one control plane and three workers
kind-redis.yamlyaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
- role: worker#Create the cluster
kind
$ kind create cluster --name redis-lab --config kind-redis.yaml Creating cluster "redis-lab" ... ---> 100% Set kubectl context to "kind-redis-lab" $ kubectl get nodes NAME STATUS ROLES AGE redis-lab-control-plane Ready control-plane 60s redis-lab-worker Ready <none> 40s redis-lab-worker2 Ready <none> 40s redis-lab-worker3 Ready <none> 40s
Everything goes in one namespace, redis, with the password in one Secret, redis-auth. Create both first:
bash
kubectl create namespace redis
kubectl -n redis create secret generic redis-auth \
--from-literal=password="$(openssl rand -base64 24)"The checks later in this guide read the password back into a shell variable:
bash
PASSWORD=$(kubectl -n redis get secret redis-auth -o jsonpath='{.data.password}' | base64 -d)