diff --git a/README.md b/README.md index 71105d1..208ae16 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,22 @@ # offline-kubernetes-install -完全离线的情况下, 安装k8s集群, 基于 CentOS7, k8s 1.21.10 版本, 容器运行时 是docker +完全离线的情况下, 安装k8s集群, 基于 CentOS7, k8s 1.21.10 版本, 容器运行时 是docker, 安装工具是kubeadm, 全部采用容器化或者rpm包的形式部署, 坚决不使用二进制。 | 脚本 | 说明 | | ------------------ | -------------------------------------- | -| 0-kernel_5.4.sh | 可选, 安装5.4内核 | +| kernel_5.4.sh | 可选, 安装5.4内核 | | 0-config.sh | 修改里面的配置, 然后执行 | -| 0-download.sh | 下载离线包, 支持断点续传 | -| 1-init.sh | 初始化配置, 所有节点都需要执行 | -| 2-create_k8s.sh | 创建集群, 只需要在一台master上执行即可 | -| 3-nginx_ingress.sh | 安装nginx-ingress | +| download.sh | 下载离线包, 支持断点续传 | +| init.sh | 初始化配置, 所有节点都需要执行 | +| create_cluster.sh | 创建集群, 只需要在一台master上执行即可 | +| nginx_ingress.sh | 安装nginx-ingress | -事先执行`0-download.sh`下载好离线包到`master1`上面 -5.4内核看个人需求是否执行, 如需更新, 执行 `scripts/0-kernel_5.4.sh` +事先执行`download.sh`下载好离线包到`master1`上面 +5.4内核看个人需求是否执行, 如需更新, 执行 `scripts/kernel_5.4.sh` ## 单节点k8s部署 -1. 执行 scripts/0-download.sh 下载需要的包 +1. 执行 scripts/download.sh 下载需要的包 2. 修改 single.env 里面的apiserver地址 3. 执行 single.sh 即可创建集群 diff --git a/cluster.sh b/cluster.sh index 686c69e..81dc23d 100755 --- a/cluster.sh +++ b/cluster.sh @@ -9,7 +9,7 @@ if [ $(id -u) != "0" ]; then fi cd scripts -./1-init.sh -sed -e "s/^apiserver=.*/apiserver=${VIP}/g" -i 2-create_k8s.sh -./2-create_k8s.sh -./3-nginx_ingress.sh +./init.sh +sed -e "s/^apiserver=.*/apiserver=${VIP}/g" -i create_cluster.sh +./create_cluster.sh +./nginx_ingress.sh diff --git a/scripts/0-config.sh b/scripts/config.sh similarity index 82% rename from scripts/0-config.sh rename to scripts/config.sh index fdb0e58..5c2c098 100755 --- a/scripts/0-config.sh +++ b/scripts/config.sh @@ -11,5 +11,5 @@ sed -e "s/__MASTER1__/${MASTER1}/g" \ -i keepalived/*.conf # 修改脚本内VIP -sed -e "s/__API_SERVER__/${VIP}/g" -i 2-create_k8s.sh +sed -e "s/__API_SERVER__/${VIP}/g" -i create_cluster.sh diff --git a/scripts/2-create_k8s.sh b/scripts/create_cluster.sh similarity index 88% rename from scripts/2-create_k8s.sh rename to scripts/create_cluster.sh index 61bd0d1..1dc46b5 100755 --- a/scripts/2-create_k8s.sh +++ b/scripts/create_cluster.sh @@ -1,12 +1,12 @@ #!/bin/bash set -euo pipefail -apiserver="__API_SERVER__" +source ../single.env # 初始化集群 sudo kubeadm init \ --kubernetes-version 1.21.10 \ - --control-plane-endpoint "${apiserver}:6443" \ + --control-plane-endpoint "${API_SERVER}:6443" \ --upload-certs \ --service-cidr=10.96.0.0/12 \ --pod-network-cidr=10.244.0.0/16 diff --git a/scripts/0-download.sh b/scripts/download.sh similarity index 100% rename from scripts/0-download.sh rename to scripts/download.sh diff --git a/scripts/1-init.sh b/scripts/init.sh similarity index 100% rename from scripts/1-init.sh rename to scripts/init.sh diff --git a/scripts/0-kernel_5.4.sh b/scripts/kernel_5.4.sh similarity index 100% rename from scripts/0-kernel_5.4.sh rename to scripts/kernel_5.4.sh diff --git a/scripts/3-nginx_ingress.sh b/scripts/nginx_ingress.sh similarity index 100% rename from scripts/3-nginx_ingress.sh rename to scripts/nginx_ingress.sh diff --git a/single.sh b/single.sh index 30632ab..2e48129 100755 --- a/single.sh +++ b/single.sh @@ -9,7 +9,6 @@ if [ $(id -u) != "0" ]; then fi cd scripts -./1-init.sh -sed -e "s/^apiserver=.*/apiserver=${API_SERVER}/g" -i 2-create_k8s.sh -./2-create_k8s.sh -./3-nginx_ingress.sh +./init.sh +./create_cluster.sh +./nginx_ingress.sh