From e7ce179d93247b8562428fbf6c16558c947c3623 Mon Sep 17 00:00:00 2001 From: Martin <1403951401@qq.com> Date: Wed, 19 Mar 2025 17:49:50 +0800 Subject: [PATCH] =?UTF-8?q?[*]=20=E6=9B=B4=E6=96=B0=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init-k8s.sh | 10 ++++++---- k8s/README.md | 11 ++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/init-k8s.sh b/init-k8s.sh index 2f995cd..163e89d 100644 --- a/init-k8s.sh +++ b/init-k8s.sh @@ -2,9 +2,11 @@ lsb_dist=$(cat /etc/*release | grep ^ID= | cut -d= -f2) # ubuntu or debian? release=$(cat /etc/*release | grep VERSION_CODENAME | cut -d= -f2) # ubuntu(jammy oracular) debian(bookworm).... -# +# 默认值 K8S_VERSION=${K8S_VERSION:-1.32} # 如果未设置,使用默认值 1.32 CONTAINERD_VERSION=${CONTAINERD_VERSION:-2.0.2} # 如果未设置,使用默认值 2.0.2 +CALICO_VERSION=${CALICO_VERSION:-3.29.1} # 如果未设置,使用默认值 2.0.2 +MIRRORS=${MIRRORS:-docker.martin98.com/k8s} # 如果未设置,默认使用集群镜像 # 更新 apt curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash @@ -244,14 +246,14 @@ clusterName: kubernetes controlPlaneEndpoint: "$vip_ip:6443" controllerManager: {} dns: - imageRepository: $mirrors/coredns + imageRepository: $MIRRORS/coredns encryptionAlgorithm: RSA-2048 etcd: local: dataDir: /var/lib/etcd -imageRepository: $mirrors +imageRepository: $MIRRORS kind: ClusterConfiguration -kubernetesVersion: $k8s_version +kubernetesVersion: $K8S_VERSION networking: dnsDomain: cluster.local podSubnet: $pod_subnet diff --git a/k8s/README.md b/k8s/README.md index cb869ed..1775ad3 100644 --- a/k8s/README.md +++ b/k8s/README.md @@ -1,13 +1,14 @@ ## 初始化每个节点环境 -### 配置 k8s 属性 ```bash -# k8s containerd 版本 +# 当前默认值 export K8S_VERSION=1.32 export CONTAINERD_VERSION=2.0.2 export CALICO_VERSION=3.29.1 -# 镜像源 k8s_version -export mirrors=docker.martin98.com/k8s -export k8s_version=1.32.1 +export MIRRORS=docker.martin98.com/k8s +``` + +### 配置 k8s 属性 +```bash # 网段配置 export pod_subnet=10.101.0.0/16 export service_subnet=10.100.0.0/16