Compare commits

...

3 Commits

Author SHA1 Message Date
zhanglikun
df6a57a27f 不要求使用root 2024-02-02 21:43:56 +08:00
zhanglikun
3b6e15310f 增加国内下载源 2024-02-02 17:53:08 +08:00
zhanglikun
02b5d3324d 整合配置文件为一个 2024-02-02 17:39:59 +08:00
7 changed files with 52 additions and 32 deletions

13
.env Normal file
View File

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

View File

@ -1,10 +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或者负载均衡的地址
API_SERVER="10.0.0.10"

View File

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

View File

@ -1,7 +1,22 @@
#!/bin/bash
set -euo pipefail
source .env
cd temp/
if [ x${USE_CHINA_MIRROR} == "xyes" ]; then
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://git.babudiu.com/iuxt/offline-kubernetes-install/releases/download/flannel/flannel.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://git.babudiu.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/kubeadm/kubeadm_images.tar.gz
curl -OL -C - https://git.babudiu.com/iuxt/offline-kubernetes-install/releases/download/kubeadm/kubeadm_rpms.tar.gz
curl -OL -C - https://git.babudiu.com/iuxt/offline-kubernetes-install/releases/download/keepalived/keepalived.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://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
@ -12,6 +27,7 @@ curl -OL -C - https://github.com/iuxt/offline-kubernetes-install/releases/downlo
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

View File

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

View File

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