更新文件结构

This commit is contained in:
zhanglikun 2024-01-30 15:56:17 +08:00
parent bcdfe273cc
commit d5b1a1abe8
8 changed files with 29 additions and 16 deletions

View File

@ -1,7 +1,15 @@
# offline-kubernetes-install # offline-kubernetes-install
完全离线的情况下, 安装k8s集群, 基于 CentOS7, k8s 1.21.10 版本, 容器运行时 是docker 安装工具是kubeadm 全部采用容器化或者rpm包的形式部署 坚决不使用二进制。 完全离线的情况下, 安装k8s集群, 基于 CentOS7, k8s 1.21.10 版本, 容器运行时 是docker 安装工具是kubeadm 全部采用容器化或者rpm包的形式部署 坚决不使用二进制。
## 系统要求
centos 7 最小化安装, 所有节点之间做好 ssh 免密并成功登录一次
提前执行scripts/download.sh下载离线包才可离线安装
## 文件介绍
| 脚本 | 说明 | | 脚本 | 说明 |
| ------------------ | -------------------------------------- | | ------------------ | -------------------------------------- |
| kernel_5.4.sh | 可选, 安装5.4内核 | | kernel_5.4.sh | 可选, 安装5.4内核 |
@ -23,3 +31,8 @@
## 集群部署 ## 集群部署
前提条件: 代码克隆到 master1 上面, 确保 master1 可以免密访问其他节点 前提条件: 代码克隆到 master1 上面, 确保 master1 可以免密访问其他节点
修改 cluster.env 配置
执行 cluster.sh 进行初始化

View File

@ -29,11 +29,11 @@ ssh root@${MASTER2} "cd /tmp/keepalived/ && bash install.sh && cp -r keepalived2
ssh root@${MASTER3} "cd /tmp/keepalived/ && bash install.sh && cp -r keepalived3.conf /etc/keepalived/keepalived.conf && systemctl restart keepalived" ssh root@${MASTER3} "cd /tmp/keepalived/ && bash install.sh && cp -r keepalived3.conf /etc/keepalived/keepalived.conf && systemctl restart keepalived"
# 创建集群 # 创建集群
ssh root@${MASTER1} "cd /tmp/scripts/ && ./init.sh" ssh root@${MASTER1} "cd /tmp/init/ && ./init.sh"
ssh root@${MASTER2} "cd /tmp/scripts/ && ./init.sh" ssh root@${MASTER2} "cd /tmp/init/ && ./init.sh"
ssh root@${MASTER3} "cd /tmp/scripts/ && ./init.sh" ssh root@${MASTER3} "cd /tmp/init/ && ./init.sh"
cd scripts cd kubeadm
./create_cluster.sh ${API_SERVER} | tee /tmp/install.log ./create_cluster.sh ${API_SERVER} | tee /tmp/install.log
# 获取安装信息 # 获取安装信息

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
cd ../temp/ cd temp/
curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/docker-ce-20.10.23-3.el7.x86_64/docker-ce-20.10.tar.gz curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/docker-ce-20.10.23-3.el7.x86_64/docker-ce-20.10.tar.gz
curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/flannel/flannel.tar.gz curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/flannel/flannel.tar.gz
curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/ingress-nginx/ingress-nginx.tar.gz curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/ingress-nginx/ingress-nginx.tar.gz
@ -10,6 +10,9 @@ curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/downlo
curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/kubeadm_rpms/kubeadm_rpms.tar.gz curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/kubeadm_rpms/kubeadm_rpms.tar.gz
curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/keepalived/keepalived.tar.gz curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/keepalived/keepalived.tar.gz
curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/bash-completion/bash-completion-2.1-8.el7.noarch.rpm curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/bash-completion/bash-completion-2.1-8.el7.noarch.rpm
curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/git/git-2.31.1.tar.gz
curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/rsync/rsync-3.1.2-12.el7_9.x86_64.rpm
md5sum -c md5.sum md5sum -c md5.sum
@ -21,3 +24,5 @@ tar xf kubeadm_images.tar.gz -C ../kubeadm/
tar xf kubeadm_rpms.tar.gz -C ../kubeadm/ tar xf kubeadm_rpms.tar.gz -C ../kubeadm/
tar xf keepalived.tar.gz -C ../keepalived/ tar xf keepalived.tar.gz -C ../keepalived/
cp bash-completion-2.1-8.el7.noarch.rpm ../kubeadm/ cp bash-completion-2.1-8.el7.noarch.rpm ../kubeadm/
tar xf git-2.31.1.tar.gz -C ../init/
cp rsync-3.1.2-12.el7_9.x86_64.rpm ../init/

2
scripts/init.sh → init/init.sh Executable file → Normal file
View File

@ -26,6 +26,8 @@ sudo sysctl --system
swapoff -a swapoff -a
sed -i 's/.*swap.*/#&/' /etc/fstab sed -i 's/.*swap.*/#&/' /etc/fstab
yum install -y ./*.rpm
cd ../docker && bash ./install.sh && cd - cd ../docker && bash ./install.sh && cd -
cd ../kubeadm && bash ./install.sh && cd - cd ../kubeadm && bash ./install.sh && cd -
cd ../flannel && bash install.sh cd ../flannel && bash install.sh

View File

@ -1,5 +0,0 @@
#!/bin/bash
set -euo pipefail
# 更新内核, 可选操作
cd ../kernel_5.4 && bash install.sh && cd -

View File

@ -1,4 +0,0 @@
#!/bin/bash
set -euo pipefail
cd ../ingress-nginx && bash install.sh && cd -

View File

@ -5,3 +5,5 @@ fdb228d3d72b103d856b43d4387b40c9 ingress-nginx.tar.gz
9beba9e40a72d2b5ae4c8616d11fc10e kubeadm_images.tar.gz 9beba9e40a72d2b5ae4c8616d11fc10e kubeadm_images.tar.gz
abcd0f840ce38a38b5201a3fb29d9d10 kubeadm_rpms.tar.gz abcd0f840ce38a38b5201a3fb29d9d10 kubeadm_rpms.tar.gz
5e7034cf2c2420bf799ecfe0720061b3 kernel_5.4.tar.gz 5e7034cf2c2420bf799ecfe0720061b3 kernel_5.4.tar.gz
f6ba68c59a78076898c93671ddcf9153 rsync-3.1.2-12.el7_9.x86_64.rpm
676e3cef57a00644233c536752d481e3 git-2.31.1.tar.gz