安装 Kind
选择安装适合您操作系统的发行版,然后将其重命名为 kind(或者在 Windows 上可能是 kind.exe)并将其放入您首选二进制安装目录的 $PATH 中
- Linux
- MacOS
- Windows
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.17.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
# for Intel Macs
[ $(uname -m) = x86_64 ]&& curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.17.0/kind-darwin-amd64
# for M1 / ARM Macs
[ $(uname -m) = arm64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.17.0/kind-darwin-arm64
chmod +x ./kind
mv ./kind /some-dir-in-your-PATH/kind
curl.exe -Lo kind-windows-amd64.exe https://kind.sigs.k8s.io/dl/v0.17.0/kind-windows-amd64
Move-Item .\kind-windows-amd64.exe c:\some-dir-in-your-PATH\kind.exe
部署多节点集群
- 创建 kind 部署清单配置文件
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: control-plane
- role: control-plane
- role: worker
- role: worker
- role: worker
- 创建集群,并命名为 kubegems
kind create cluster --name kubegems --config kind-config.yaml
- 创建成功后,使用
kubectl get node
命令来检查集群节点状态
kubectl get node
NAME STATUS ROLES AGE VERSION
dev-control-plane Ready master 2m15s v1.21.10
dev-control-plane2 Ready master 99s v1.21.10
dev-control-plane3 Ready master 49s v1.21.10
dev-worker Ready <none> 32s v1.21.10
dev-worker2 Ready <none> 32s v1.21.10
dev-worker3 Ready <none> 32s v1.21.10