Cluster KinD
Installiamo kind:
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.14.0/kind-linux-amd64 && \
chmod +x ./kind && \
sudo mv ./kind /usr/local/bin/kind
Editare il file kind.yml
:
vim kind.yml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
Scarico dell'immagine del cluster Kubernetes per Kind:
docker pull kindest/node:v1.24.0
E' una immagine relativamente grossa, impiega del tempo.
Lancio del cluster:
kind create cluster --config kind.yml --image kindest/node:v1.24.0
Creating cluster "kind" ...
✓ Ensuring node image (kindest/node:v1.24.0) 🖼
✓ Preparing nodes 📦 📦 📦
✓ Writing configuration 📜
✓ Starting control-plane 🕹️
✓ Installing CNI 🔌
✓ Installing StorageClass 💾
✓ Joining worker nodes 🚜
Set kubectl context to "kind-kind"
Impiega qualche minuto. Il cluster è ora pronto.
Informazioni sul cluster:
kubectl cluster-info --context kind-kind
Kubernetes control plane is running at https://127.0.0.1:44391
CoreDNS is running at https://127.0.0.1:44391/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Listare i nodi:
kubectl get nodes
NAME STATUS ROLES AGE VERSION
kind-control-plane Ready control-plane 7m31s v1.24.0
kind-worker Ready <none> 6m22s v1.24.0
kind-worker2 Ready <none> 6m22s v1.24.0
Affinchè tutti i nodi siano pronti può richiedere qualche minuto.