1.安装 WSL2

2.安装 Docker Desktop

3.安装 Kind

curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.8.1/kind-$(uname)-amd64

chmod +x ./kind

sudo mv ./kind /usr/local/bin/

kind version

WSL2 使用Kind创建Kubernetes开发集群环境

4.创建 单Master集群(可省略)

# pull image kindest/node:v1.18.2
docker pull ccr.ccs.tencentyun.com/kindest/node:v1.18.2
docker tag ccr.ccs.tencentyun.com/kindest/node:v1.18.2 kindest/node:v1.18.2
docker rmi ccr.ccs.tencentyun.com/kindest/node:v1.18.2
# create master
kind create cluster --image kindest/node:v1.18.2 --name k8s

kubectl get nodes

# Delete the existing cluster
kind delete cluster --name k8s

5. 创建 多节点集群

 

# Create a config file for a 3 nodes cluster
cat << EOF > kind-3nodes.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
  - role: control-plane
  - role: worker
  - role: worker
EOF

# pull image kindest/node:v1.18.2
docker pull ccr.ccs.tencentyun.com/kindest/node:v1.18.2
docker tag ccr.ccs.tencentyun.com/kindest/node:v1.18.2 kindest/node:v1.18.2
docker rmi ccr.ccs.tencentyun.com/kindest/node:v1.18.2

# Create a new cluster with the config file
kind create cluster --image kindest/node:v1.18.2 --name k8s --config ./kind-3nodes.yaml

# Check how many nodes it created
kubectl get nodes

 

WSL2 使用Kind创建Kubernetes开发集群环境

以上操作,我们创建了一个三节点集群

kubectl get all --all-namespaces

WSL2 使用Kind创建Kubernetes开发集群环境

 

 6.创建仪表板(可选)

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.3/aio/deploy/recommended.yaml

WSL2 使用Kind创建Kubernetes开发集群环境

 

 

kubectl get all -n kubernetes-dashboard

kubectl proxy

WSL2 使用Kind创建Kubernetes开发集群环境

 

相关文章:

  • 2021-12-17
  • 2021-07-22
  • 2022-02-20
  • 2021-10-19
  • 2022-12-23
  • 2021-09-30
  • 2021-06-24
  • 2021-06-26
猜你喜欢
  • 2022-12-23
  • 2021-08-08
  • 2021-12-29
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
相关资源
相似解决方案