Compare commits

..

No commits in common. "main" and "git" have entirely different histories.
main ... git

7 changed files with 32 additions and 52 deletions

13
.env
View File

@ -1,13 +0,0 @@
# master 节点的IP, 单节点版不用配置
MASTER1="10.0.0.11"
MASTER2="10.0.0.12"
MASTER3="10.0.0.13"
# master 节点的网卡设备名, 单节点版不用配置
NETWORK_NIC="eth0"
# api server 填vip或者负载均衡的地址, 如果是单节点 填自己的IP地址
API_SERVER="10.0.0.10"
# 是否使用国内源
USE_CHINA_MIRROR="no"

View File

@ -1,13 +1,5 @@
# offline-kubernetes-install # offline-kubernetes-install
完全离线的情况下, 安装k8s集群, 基于 CentOS7, k8s 1.21.10 版本, 容器运行时 是docker 安装工具是kubeadm 全部采用容器化或者rpm包的形式部署 坚决不使用二进制。
## 项目特点
基于 CentOS7, k8s 1.21.10 版本
- 完全离线的情况下, 安装k8s集群
- 容器运行时为 docker
- 安装工具为 kubeadm
- 全部采用容器化或者rpm包的形式部署
- 支持使用国内源进行下载
## 系统要求 ## 系统要求
@ -36,7 +28,7 @@ centos 7 最小化安装, 所有节点之间做好 ssh 免密并成功登录一
## 单节点k8s部署 ## 单节点k8s部署
1. 执行 download.sh 下载需要的包 1. 执行 download.sh 下载需要的包
2. 修改 .env 里面的apiserver地址, 单节点就填自己的 ip 2. 修改 single.env 里面的apiserver地址, 单节点就填自己的 ip
3. 执行 single.sh 即可创建单 master k8s 3. 执行 single.sh 即可创建单 master k8s
## 集群部署 ## 集群部署
@ -45,7 +37,7 @@ centos 7 最小化安装, 所有节点之间做好 ssh 免密并成功登录一
执行 download.sh 下载需要的包 执行 download.sh 下载需要的包
修改 .env 配置 修改 cluster.env 配置
执行 cluster.sh 进行初始化 执行 cluster.sh 进行初始化

10
cluster.env Normal file
View File

@ -0,0 +1,10 @@
# master 节点的IP
MASTER1="10.0.0.11"
MASTER2="10.0.0.12"
MASTER3="10.0.0.13"
# master 节点的网卡设备名
NETWORK_NIC="eth0"
# api server 填vip或者负载均衡的地址
API_SERVER="10.0.0.10"

View File

@ -1,6 +1,11 @@
#!/bin/bash #!/bin/bash
source .env source cluster.env
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script"
exit 1
fi
# 部署之前先分发 init 内容 # 部署之前先分发 init 内容
scp -r init/ root@${MASTER1}:/tmp/ scp -r init/ root@${MASTER1}:/tmp/

View File

@ -1,33 +1,17 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
source .env
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
if [ x${USE_CHINA_MIRROR} == "xyes" ]; then curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/flannel/flannel.tar.gz
curl -OL -C - https://git.babudiu.com/iuxt/offline-kubernetes-install/releases/download/docker-ce/docker-ce-20.10.tar.gz curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/ingress-nginx/ingress-nginx.tar.gz
curl -OL -C - https://git.babudiu.com/iuxt/offline-kubernetes-install/releases/download/flannel/flannel.tar.gz curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/kernel_5.4/kernel_5.4.tar.gz
curl -OL -C - https://git.babudiu.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/kubeadm_images/kubeadm_images.tar.gz
curl -OL -C - https://git.babudiu.com/iuxt/offline-kubernetes-install/releases/download/kernel_5.4/kernel_5.4.tar.gz curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/kubeadm_rpms/kubeadm_rpms.tar.gz
curl -OL -C - https://git.babudiu.com/iuxt/offline-kubernetes-install/releases/download/kubeadm/kubeadm_images.tar.gz curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/keepalived/keepalived.tar.gz
curl -OL -C - https://git.babudiu.com/iuxt/offline-kubernetes-install/releases/download/kubeadm/kubeadm_rpms.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://git.babudiu.com/iuxt/offline-kubernetes-install/releases/download/keepalived/keepalived.tar.gz curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/git/git-2.31.1.tar.gz
curl -OL -C - https://git.babudiu.com/iuxt/offline-kubernetes-install/releases/download/rpms/bash-completion-2.1-8.el7.noarch.rpm curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/rsync/rsync-3.1.2-12.el7_9.x86_64.rpm
curl -OL -C - https://git.babudiu.com/iuxt/offline-kubernetes-install/releases/download/git/git-2.31.1.tar.gz
curl -OL -C - https://git.babudiu.com/iuxt/offline-kubernetes-install/releases/download/rpms/rsync-3.1.2-12.el7_9.x86_64.rpm
else
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/ingress-nginx/ingress-nginx.tar.gz
curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/kernel_5.4/kernel_5.4.tar.gz
curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/download/kubeadm_images/kubeadm_images.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/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
fi
md5sum -c md5.sum md5sum -c md5.sum

2
single.env Normal file
View File

@ -0,0 +1,2 @@
# 单节点 填自己的IP地址
API_SERVER="10.0.0.32"

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
source .env source single.env
if [ $(id -u) != "0" ]; then if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script" echo "Error: You must be root to run this script"