集群搭建
1node.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
3node.yaml
标准多节点配置,1 个控制平面 + 2 个工作节点
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
- role: worker
- role: worker
本地kind 集群搭建
kind create cluster --name knative-cluster --config 1node.yaml --image kindest/node:v1.32.0
Creating cluster "knative-cluster" ...
✓ Ensuring node image (kindest/node:v1.32.0) 🖼
✓ Preparing nodes 📦
✓ Writing configuration 📜
✓ Starting control-plane 🕹️
✓ Installing CNI 🔌
✓ Installing StorageClass 💾
Set kubectl context to "kind-knative-cluster"
You can now use your cluster with:
kubectl cluster-info --context kind-knative-cluster
集群删除
# 1. 删除集群本体
kind delete cluster --name knative-cluster
# 2. 清理 kubeconfig 中的 context
kubectl config delete-context knative-cluster
kubectl config delete-cluster knative-cluster
kubectl config unset users.knative-cluster