Local environment
All examples in the book can be executed locally on a Kubernetes cluster created by kind.
To provision a local Kubernetes cluster using Docker container nodes, first prepare a configuration file that defines a multi-node cluster:
cat > multi-node-k8s-no-cni.yaml <<EOF
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
networking:
disableDefaultCNI: true
podSubnet: 192.168.0.0/16
EOF
In the YAML file, there are 2 worker nodes and 1 control plane node defined. The default CNI (Container Network Interface) plugin (kindnetd
- a simple networking implementation) is disabled, as we will deploy a dedicated one later.
The Kubernetes cluster can be created using the YAML configuration file:
kind create cluster --config multi-node-k8s-no-cni.yaml --name home-lab
After the deployment is finished, the list of nodes can be checked with the following command:
kubectl get nodes -o wide
Moreover, the list of kind clusters can be verified with the following command:
kind get clusters
If necessary, the cluster can be removed with the following command:
kind delete cluster --name home-lab