Commit 6a0f2ea1 by tingweiwang

fix bug

1 parent a8ac8273
Showing with 4 additions and 21 deletions
...@@ -52,9 +52,9 @@ ansible new_node -m shell -a "service flanneld status" ...@@ -52,9 +52,9 @@ ansible new_node -m shell -a "service flanneld status"
ansible new_node -m shell -a "systemctl enable flanneld.service" ansible new_node -m shell -a "systemctl enable flanneld.service"
#############################安装docker############################################ #############################安装docker############################################
echo "判断当前节点是gpu,还是cpu节点,根据节点不同,完成不同操作&& sleep 2" echo "判断当前节点是gpu,还是cpu节点,根据节点不同,完成不同操作&& sleep 2"
test=`lspci |grep -i vga |wc -l >/dev/null` test=`lspci |grep -i vga |wc -l`
if [ $test -gt 1 ];then if [ $test -gt 1 ];then
echo "当前节点是GPU节点,开始按照docker" && sleep 2 && apt install nvidia-docker2 --allow-unauthenticated -y echo "当前节点是GPU节点,开始配置gpu类型docker" && sleep 2 && apt install nvidia-docker2 --allow-unauthenticated -y
echo "当前harbor仓库地址为$harbor_host" echo "当前harbor仓库地址为$harbor_host"
sed -i s/harbor_host/$harbor_host/g /root/k8s/config/daemon.json_gpu sed -i s/harbor_host/$harbor_host/g /root/k8s/config/daemon.json_gpu
echo "开始安装docker" echo "开始安装docker"
...@@ -69,12 +69,12 @@ if [ $test -gt 1 ];then ...@@ -69,12 +69,12 @@ if [ $test -gt 1 ];then
echo "还原daemon.json模板文件" echo "还原daemon.json模板文件"
sed -i s/$harbor_host/harbor_host/g /root/k8s/config/daemon.json_gpu sed -i s/$harbor_host/harbor_host/g /root/k8s/config/daemon.json_gpu
else else
echo "当前节点是CPU节点,开始安装配置docker && sleep 2" echo "当前节点是CPU节点,开始安装配置cpu 类型docker && sleep 2"
echo "当前harbor仓库地址为$harbor_host," echo "当前harbor仓库地址为$harbor_host,"
sed -i s/harbor_host/$harbor_host/g /root/k8s/config/daemon.json_cpu sed -i s/harbor_host/$harbor_host/g /root/k8s/config/daemon.json_cpu
echo "开始安装docker" echo "开始安装docker"
ansible new_node -m shell -a "apt update --allow-insecure-repositories" ansible new_node -m shell -a "apt update --allow-insecure-repositories"
ansible new_node -m shell -a "apt install conntrack docker-ce -y --allow-unauthenticated" ansible new_node -m shell -a "apt install conntrack nfs-common docker-ce -y --allow-unauthenticated"
echo "分发已修改的daemon.json文件" echo "分发已修改的daemon.json文件"
ansible new_node -m copy -a "src=/root/k8s/config/daemon.json_cpu dest=/etc/docker/daemon.json" ansible new_node -m copy -a "src=/root/k8s/config/daemon.json_cpu dest=/etc/docker/daemon.json"
ansible new_node -m copy -a "src=/root/k8s/service/docker.service dest=/lib/systemd/system/docker.service mode=755" ansible new_node -m copy -a "src=/root/k8s/service/docker.service dest=/lib/systemd/system/docker.service mode=755"
...@@ -84,23 +84,6 @@ else ...@@ -84,23 +84,6 @@ else
echo "还原daemon.json模板文件" echo "还原daemon.json模板文件"
sed -i s/$harbor_host/harbor_host/g /root/k8s/config/daemon.json_cpu sed -i s/$harbor_host/harbor_host/g /root/k8s/config/daemon.json_cpu
fi fi
#echo "当前harbor仓库地址为$harbor_host,"
#sed -i s/harbor_host/$harbor_host/g /root/k8s/config/daemon.json
#echo "开始安装docker"
#ansible new_node -m shell -a "apt update --allow-insecure-repositories"
#ansible new_node -m shell -a "apt install conntrack docker-ce -y --allow-unauthenticated"
#echo "拷贝docker.service到新node节点"
#ansible new_node -m copy -a "src=/root/k8s/service/docker.service dest=/lib/systemd/system/docker.service mode=755"
#ansible new_node -m shell -a "systemctl daemon-reload"
#echo "分发已修改的daemon.json文件"
#ansible new_node -m copy -a "src=/root/k8s/config/daemon.json dest=/etc/docker/"
#ansible new_node -m shell -a "service docker restart"
#ansible new_node -m shell -a "service docker status"
#ansible new_node -m shell -a "cat /etc/docker/daemon.json"
#echo "还原daemon.json模板文件"
#sed -i s/$harbor_host/harbor_host/g /root/k8s/config/daemon.json
###################################################################################
ansible new_node -m shell -a "apt install nfs-common --allow-unauthenticated"
########################################################################################### ###########################################################################################
ansible new_node -m copy -a "src=/root/k8s/bin/kube-proxy dest=/opt/kubernetes/bin/ mode=777" ansible new_node -m copy -a "src=/root/k8s/bin/kube-proxy dest=/opt/kubernetes/bin/ mode=777"
ansible new_node -m copy -a "src=/root/k8s/bin/kubelet dest=/opt/kubernetes/bin/ mode=777" ansible new_node -m copy -a "src=/root/k8s/bin/kubelet dest=/opt/kubernetes/bin/ mode=777"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!