[+] 更新 k8s 集群
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 10s
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 10s
This commit is contained in:
parent
9faf6f2f1b
commit
6bbe4a755c
@ -4,25 +4,16 @@
|
||||
# k8s containerd 版本
|
||||
export K8S_VERSION=1.32
|
||||
export CONTAINERD_VERSION=2.0.2
|
||||
export CALICO_VERSION=3.27.5
|
||||
export CALICO_VERSION=3.29.1
|
||||
# 镜像源 k8s_version
|
||||
export mirrors=docker.martin98.com/k8s
|
||||
export k8s_version=1.32.1
|
||||
# 网段配置
|
||||
export pod_subnet=10.101.0.0/16
|
||||
export service_subnet=10.100.0.0/16
|
||||
```
|
||||
|
||||
```bash
|
||||
# 设置
|
||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-k8s.sh | bash
|
||||
|
||||
# 配置主机 host
|
||||
cat >> /etc/hosts <<EOF
|
||||
|
||||
EOF
|
||||
```
|
||||
|
||||
### 初始化 master 节点
|
||||
```bash
|
||||
cat <<EOF > kubeadm-config.yaml
|
||||
apiVersion: kubeadm.k8s.io/v1beta4
|
||||
@ -85,11 +76,17 @@ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
|
||||
sudo chown $(id -u):$(id -g) $HOME/.kube/config
|
||||
export KUBECONFIG=/etc/kubernetes/admin.conf
|
||||
|
||||
# 安装 operator
|
||||
kubectl create -f https://mirrors.martin98.com/repository/proxy/raw.githubusercontent.com/projectcalico/calico/v$CALICO_VERSION/manifests/tigera-operator.yaml
|
||||
kubectl get pods -n tigera-operator
|
||||
|
||||
kubectl wait --for=condition=Ready pods --all -n tigera-operator --timeout=300s
|
||||
# 安装 calico
|
||||
curl https://mirrors.martin98.com/repository/proxy/raw.githubusercontent.com/projectcalico/calico/v$CALICO_VERSION/manifests/calico.yaml -O
|
||||
sed -i '/^[[:space:]]*# - name: CALICO_IPV4POOL_CIDR/s/# //' calico.yaml
|
||||
sed -i '/CALICO_IPV4POOL_CIDR/ {n; s|#\s||; s|value: ".*"|value: "'"$pod_subnet"'"|;}' calico.yaml
|
||||
kubectl apply -f calico.yaml
|
||||
curl https://mirrors.martin98.com/repository/proxy/raw.githubusercontent.com/projectcalico/calico/v$CALICO_VERSION/manifests/custom-resources.yaml -O
|
||||
sed -i "s|\(cidr: \).*|\1$pod_subnet|" custom-resources.yaml
|
||||
kubectl create -f custom-resources.yaml
|
||||
kubectl wait --for=condition=Ready pods --all -n calico-system --timeout=300s
|
||||
kubectl wait --for=condition=Ready pods --all -n calico-apiserver --timeout=300s
|
||||
```
|
||||
|
||||
### 加入集群
|
||||
|
Loading…
x
Reference in New Issue
Block a user