整理文件结构

This commit is contained in:
zhanglikun 2023-09-12 17:28:07 +08:00
parent 6b1d891775
commit bb0cf1697d
14 changed files with 32 additions and 5 deletions

2
.env
View File

@ -1,3 +1,5 @@
MODE="single"
# MODE="cluster"
MASTER1="10.0.0.112" MASTER1="10.0.0.112"
MASTER2="10.0.0.122" MASTER2="10.0.0.122"
MASTER3="10.0.0.132" MASTER3="10.0.0.132"

View File

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

View File

@ -10,3 +10,9 @@
| 1-init.sh | 初始化配置, 所有节点都需要执行 | | 1-init.sh | 初始化配置, 所有节点都需要执行 |
| 2-create_k8s.sh | 创建集群, 只需要在一台master上执行即可 | | 2-create_k8s.sh | 创建集群, 只需要在一台master上执行即可 |
| 3-nginx_ingress.sh | 安装nginx-ingress | | 3-nginx_ingress.sh | 安装nginx-ingress |
事先执行0-download.sh下载好离线包到master1上面
5.4内核看个人需求是否执行
## 单节点k8s部署

View File

@ -1,4 +1,7 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
yum install -y docker-ce-20.10/*.rpm yum install -y docker-ce-20.10/*.rpm
sudo mkdir /etc/docker sudo mkdir /etc/docker

View File

@ -1,3 +1,6 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
ls *.tar | xargs -I {} docker load -i {} ls *.tar | xargs -I {} docker load -i {}
kubectl apply -f ./kube-flannel.yml kubectl apply -f ./kube-flannel.yml

View File

@ -1,4 +1,7 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
ls *.tar | xargs -I {} docker load -i {} ls *.tar | xargs -I {} docker load -i {}
kubectl taint node $(hostname) node-role.kubernetes.io/master- kubectl taint node $(hostname) node-role.kubernetes.io/master-
kubectl apply -f ./nginx-ingress-daemonset.yaml kubectl apply -f ./nginx-ingress-daemonset.yaml

View File

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
yum install -y ./*.rpm yum install -y ./*.rpm
systemctl enable --now keepalived systemctl enable --now keepalived

View File

@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
yum install -y ./*.rpm yum install -y ./*.rpm
ls *.tar | xargs -I {} docker load -i {} ls *.tar | xargs -I {} docker load -i {}
systemctl enable --now kubelet systemctl enable --now kubelet

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

5
scripts/0-kernel_5.4.sh Executable file
View File

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

View File

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
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"

View File

@ -1,4 +1,8 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
source .env
apiserver="__API_SERVER__" apiserver="__API_SERVER__"

View File

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