Last active
April 10, 2024 03:45
-
-
Save yankay/56811ecc4b8324b1cba602e0213537a3 to your computer and use it in GitHub Desktop.
快速创建 kind 集群(Ubuntu)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export KUBE_VERSION="1.29.2" | |
export KIND_VERSION=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' ) | |
# 配置内核 | |
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf | |
br_netfilter | |
EOF | |
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf | |
net.bridge.bridge-nf-call-ip6tables = 1 | |
net.bridge.bridge-nf-call-iptables = 1 | |
EOF | |
sudo sysctl --system | |
# 安装 KIND | |
curl -Lo ./kind https://files.m.daocloud.io/github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64 | |
chmod +x ./kind | |
mv ./kind /usr/bin/kind | |
service docker start | |
cat <<EOF | sudo tee /root/kind.yml | |
kind: Cluster | |
apiVersion: kind.x-k8s.io/v1alpha4 | |
nodes: | |
- role: control-plane | |
- role: worker | |
EOF | |
kind create cluster --config /root/kind.yml --image release-ci.daocloud.io/docker.m.daocloud.io/kindest/node:v${KUBE_VERSION} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment