Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
tingweiwang
/
k8s
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 8868a4a7
authored
Sep 27, 2020
by
tingweiwang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add_node.sh 添加节点后为自己打lable失败。hostname无法识别
1 parent
2bd8a9c2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
1 deletions
script/k8s/add_node.sh
script/k8s/add_node.sh
View file @
8868a4a
...
...
@@ -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
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment