Commit 8868a4a7 by tingweiwang

add_node.sh 添加节点后为自己打lable失败。hostname无法识别

1 parent 2bd8a9c2
Showing with 1 additions and 1 deletions
......@@ -177,6 +177,6 @@ ansible new_node -m copy -a "src=/usr/bin/kubectl dest=/usr/bin/kubectl mode=777
ansible new_node -m shell -a "mkdir /root/.kube/ -pv"
ansible new_node -m copy -a "src=/root/.kube/config dest=/root/.kube/config mode=777"
echo "根据自己的节点类型通过kubectl打标签"
ansible new_node -m shell -a 'if [ `lspci |grep -i nvidia|wc -l` -gt 0 ]; then echo "本机是gpu节点,开始打gpu类型标签" && kubectl label node `hostname` autodl=true kpl=true gpu=true cpu=true user_job_node=true internal_service_node=true; else echo "本机是cpu节点,开始打cpu类型标签"&& kubectl label node `hostname` autodl=true kpl=true cpu=true user_job_node=true internal_service_node=true ; fi'
ansible new_node -m shell -a 'if [ `lspci |grep -i nvidia|wc -l` -gt 0 ]; then echo "本机是gpu节点,开始打gpu类型标签" && cat /etc/hostname |xargs -I {} kubectl label nodes {} autodl=true kpl=true gpu=true cpu=true user_job_node=true internal_service_node=true; else echo "本机是cpu节点,开始打cpu类型标签"&& cat /etc/hostname |xargs -I {} kubectl label nodes {} autodl=true kpl=true cpu=true user_job_node=true internal_service_node=true ; fi'
sleep 3
kubectl get node --show-labels
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!