bugfix
This commit is contained in:
parent
1dd76f7b26
commit
4fb4750997
BIN
script/.gpu_init.sh.swp
Normal file
BIN
script/.gpu_init.sh.swp
Normal file
Binary file not shown.
10
script/ctrl_init.sh
Normal file
10
script/ctrl_init.sh
Normal file
@ -0,0 +1,10 @@
|
||||
sudo kubeadm init --kubernetes-version=v1.29.0 --pod-network-cidr=10.244.0.0/16
|
||||
# 保存 kubeconfig
|
||||
mkdir -p $HOME/.kube
|
||||
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
|
||||
sudo chown $(id -u):$(id -g) $HOME/.kube/config
|
||||
|
||||
kubectl apply -f /opt/offline/kubevirt/kubevirt-operator.yaml
|
||||
kubectl apply -f /opt/offline/kubevirt/kubevirt-cr.yaml
|
||||
|
||||
kubeadm token create --print-join-command
|
||||
59
script/download_pkgs.sh
Executable file
59
script/download_pkgs.sh
Executable file
@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
mkdir -p /opt/offline/{k8s,containerd,kubevirt,nvidia,dependencies}
|
||||
|
||||
# -------------------------------
|
||||
# 1. Ubuntu 22.04 系统依赖
|
||||
# -------------------------------
|
||||
sudo apt update
|
||||
DEBS="curl conntrack socat ipvsadm iptables bridge-utils ethtool git wget tar"
|
||||
mkdir -p /opt/offline/dependencies
|
||||
for pkg in $DEBS; do
|
||||
apt download $pkg
|
||||
mv *.deb /opt/offline/dependencies/
|
||||
done
|
||||
|
||||
# -------------------------------
|
||||
# 2. Kubernetes 组件
|
||||
# -------------------------------
|
||||
K8S_VERSION="1.29.0"
|
||||
mkdir -p /opt/offline/k8s
|
||||
cd /opt/offline/k8s
|
||||
curl -LO https://dl.k8s.io/release/v${K8S_VERSION}/bin/linux/amd64/kubeadm
|
||||
curl -LO https://dl.k8s.io/release/v${K8S_VERSION}/bin/linux/amd64/kubelet
|
||||
curl -LO https://dl.k8s.io/release/v${K8S_VERSION}/bin/linux/amd64/kubectl
|
||||
chmod +x kubeadm kubelet kubectl
|
||||
|
||||
# -------------------------------
|
||||
# 3. Containerd
|
||||
# -------------------------------
|
||||
CONTAINERD_VERSION="1.9.12"
|
||||
cd /opt/offline/containerd
|
||||
wget https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/containerd-${CONTAINERD_VERSION}-linux-amd64.tar.gz
|
||||
|
||||
# -------------------------------
|
||||
# 4. NVIDIA Container Toolkit & Drivers
|
||||
# -------------------------------
|
||||
mkdir -p /opt/offline/nvidia
|
||||
# 下载 NVIDIA driver (根据 GPU 型号自行选择)
|
||||
# 示例: NVIDIA-Linux-x86_64-525.85.12.run
|
||||
wget -O /opt/offline/nvidia/NVIDIA-DRIVER.run http://us.download.nvidia.com/XFree86/Linux-x86_64/525.85.12/NVIDIA-Linux-x86_64-525.85.12.run
|
||||
# 下载 NVIDIA container toolkit
|
||||
wget -O /opt/offline/nvidia/nvidia-container-toolkit.deb https://github.com/NVIDIA/nvidia-docker/releases/download/v2.13.0/nvidia-container-toolkit_2.13.0-1_all.deb
|
||||
wget -O /opt/offline/nvidia/nvidia-container-runtime.deb https://github.com/NVIDIA/nvidia-docker/releases/download/v2.13.0/nvidia-container-runtime_2.13.0-1_amd64.deb
|
||||
|
||||
# -------------------------------
|
||||
# 5. KubeVirt Operator + CR
|
||||
# -------------------------------
|
||||
mkdir -p /opt/offline/kubevirt
|
||||
curl -L https://github.com/kubevirt/kubevirt/releases/download/v1.28.0/kubevirt-operator.yaml -o /opt/offline/kubevirt/kubevirt-operator.yaml
|
||||
curl -L https://github.com/kubevirt/kubevirt/releases/download/v1.28.0/kubevirt-cr.yaml -o /opt/offline/kubevirt/kubevirt-cr.yaml
|
||||
|
||||
# -------------------------------
|
||||
# 6. GPU Operator
|
||||
# -------------------------------
|
||||
mkdir -p /opt/offline/nvidia/gpu-operator
|
||||
curl -L https://github.com/NVIDIA/gpu-operator/archive/refs/heads/main.tar.gz -o /opt/offline/nvidia/gpu-operator/gpu-operator.tar.gz
|
||||
|
||||
echo "Offline package download completed. All packages are in /opt/offline/"
|
||||
|
||||
49
script/install_offline.sh
Normal file
49
script/install_offline.sh
Normal file
@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
# GPU节点
|
||||
# sudo bash install_offline.sh gpu
|
||||
# 控制节点或普通工作节点
|
||||
# sudo bash install_offline.sh
|
||||
set -e
|
||||
|
||||
OFFLINE_DIR="/opt/offline"
|
||||
|
||||
# -------------------------------
|
||||
# 1. 安装依赖
|
||||
# -------------------------------
|
||||
dpkg -i $OFFLINE_DIR/dependencies/*.deb || apt-get -f install -y
|
||||
|
||||
# -------------------------------
|
||||
# 2. 安装 containerd
|
||||
# -------------------------------
|
||||
tar -C /usr/local -xzf $OFFLINE_DIR/containerd/containerd-*.tar.gz
|
||||
ln -s /usr/local/bin/containerd /usr/bin/containerd
|
||||
ln -s /usr/local/bin/containerd-shim /usr/bin/containerd-shim
|
||||
ln -s /usr/local/bin/ctr /usr/bin/ctr
|
||||
containerd --version
|
||||
|
||||
# -------------------------------
|
||||
# 3. 安装 Kubernetes
|
||||
# -------------------------------
|
||||
cp $OFFLINE_DIR/k8s/kubeadm /usr/bin/
|
||||
cp $OFFLINE_DIR/k8s/kubelet /usr/bin/
|
||||
cp $OFFLINE_DIR/k8s/kubectl /usr/bin/
|
||||
chmod +x /usr/bin/kubeadm /usr/bin/kubelet /usr/bin/kubectl
|
||||
|
||||
# -------------------------------
|
||||
# 4. GPU 节点额外安装 NVIDIA 驱动与 runtime
|
||||
# -------------------------------
|
||||
if [ "$1" == "gpu" ]; then
|
||||
chmod +x $OFFLINE_DIR/nvidia/NVIDIA-DRIVER.run
|
||||
$OFFLINE_DIR/nvidia/NVIDIA-DRIVER.run --silent
|
||||
dpkg -i $OFFLINE_DIR/nvidia/nvidia-container-toolkit.deb
|
||||
dpkg -i $OFFLINE_DIR/nvidia/nvidia-container-runtime.deb
|
||||
fi
|
||||
|
||||
# -------------------------------
|
||||
# 5. 启动 containerd & kubelet
|
||||
# -------------------------------
|
||||
systemctl enable containerd --now
|
||||
systemctl enable kubelet --now
|
||||
|
||||
echo "Offline install completed on $(hostname)"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user