Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
tingweiwang
/
pro-deploy-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 114dbc4c
authored
Feb 25, 2020
by
wangtingwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add_node.sh fix bug
1 parent
3dc0ee46
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
k8s/script/add_node.sh
k8s/script/set_gpu_node.sh
k8s/script/add_node.sh
View file @
114dbc4
...
@@ -4,7 +4,8 @@ etcd2_ip=10.12.4.8
...
@@ -4,7 +4,8 @@ etcd2_ip=10.12.4.8
etcd3_ip
=
10.12.4.19
etcd3_ip
=
10.12.4.19
master_ip
=
10.12.4.12
master_ip
=
10.12.4.12
new_node
=(
new_node
=(
10.12.4.17
10.12.5.17
10.12.5.18
)
)
##########################################################sshpass###############################
##########################################################sshpass###############################
:<<!
:<<!
...
@@ -17,7 +18,13 @@ done
...
@@ -17,7 +18,13 @@ done
#################################################################################################
#################################################################################################
ansible new_node -m script -a
"/root/k8s/config/init.sh"
ansible new_node -m script -a
"/root/k8s/config/init.sh"
ansible new_node -m shell -a
"mkdir /opt/kubernetes/{cfg,bin,ssl,log} -pv"
ansible new_node -m shell -a
"mkdir /opt/kubernetes/{cfg,bin,ssl,log} -pv"
scp /opt/kubernetes/ssl/ca
*
$new_node
:/opt/kubernetes/ssl/
ansible new_node -m copy -a
"src=/opt/kubernetes/ssl/ca* dest=/opt/kubernetes/ssl/"
ansible new_node -m shell -a
"apt install nfs-common -y"
######################################拷贝ca证书############################
for
ip
in
${
new_node
[@]
}
do
scp /opt/kubernetes/ssl/ca
*
$ip
:/opt/kubernetes/ssl/
done
#############################docker############################################
#############################docker############################################
ansible new_node -m script -a
"/root/k8s/config/docker.sh"
ansible new_node -m script -a
"/root/k8s/config/docker.sh"
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"
...
@@ -71,7 +78,7 @@ kubectl config use-context default --kubeconfig=bootstrap.kubeconfig
...
@@ -71,7 +78,7 @@ kubectl config use-context default --kubeconfig=bootstrap.kubeconfig
ansible new_node -m copy -a
"src=/root/k8s/script/bootstrap.kubeconfig dest=/opt/kubernetes/cfg/ mode=644"
ansible new_node -m copy -a
"src=/root/k8s/script/bootstrap.kubeconfig dest=/opt/kubernetes/cfg/ mode=644"
ansible new_node -m copy -a
"src=/opt/kubernetes/cfg/token.csv dest=/opt/kubernetes/cfg/"
ansible new_node -m copy -a
"src=/opt/kubernetes/cfg/token.csv dest=/opt/kubernetes/cfg/"
##############################################################################################
##############################################################################################
for
new_node_ip
in
$
new_node
for
new_node_ip
in
$
{
new_node
[@]
}
do
do
cat >>/opt/kubernetes/cfg/kubelet.
$new_node_ip
<<EOF
cat >>/opt/kubernetes/cfg/kubelet.
$new_node_ip
<<EOF
KUBELET_OPTS="--logtostderr=false \
KUBELET_OPTS="--logtostderr=false \
...
@@ -150,4 +157,7 @@ ansible new_node -m shell -a "service kube-proxy restart"
...
@@ -150,4 +157,7 @@ ansible new_node -m shell -a "service kube-proxy restart"
#######################开机启动################################
#######################开机启动################################
ansible new_node -m shell -a
"systemctl enable kubelet.service"
ansible new_node -m shell -a
"systemctl enable kubelet.service"
ansible new_node -m shell -a
"systemctl enable kube-proxy.service"
ansible new_node -m shell -a
"systemctl enable kube-proxy.service"
!
##########################节点打label##########################################
#for new_node_host in ${new_node[@]}
#do
#kubectl label node xxxx autodl=true seetaas=true gpu=true user_job_node=true internal_service_node=true
k8s/script/set_gpu_node.sh
View file @
114dbc4
ansible new_gpu_node -m copy -a
"src=/root/k8s/config/daemon.json_gpu dest=/etc/docker/daemon.json"
ansible new_gpu_node -m copy -a
"src=/root/k8s/config/daemon.json_gpu dest=/etc/docker/daemon.json"
ansible new_gpu_node -m shell -a
"service docker restart"
ansible new_gpu_node -m shell -a
"service docker restart"
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