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 a9ba7a5b
authored
Aug 15, 2020
by
tingweiwang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自动根据脚本中new_node节点清单,自动配置ansible hosts,需要注意如果节点已加入集群,需要将已加入节点注释掉,然后再执行add_node.sh否则已加入的节点会重新被初始化配置。
1 parent
92495322
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
script/k8s/add_node.sh
script/k8s/add_node.sh
View file @
a9ba7a5
...
...
@@ -6,13 +6,23 @@ new_node=(
192.168.1.58
)
#可以写多个node。每行一个。
interface
=
eno1
###############
##########################################sshpass
###############
配置节点免密###########
port
=
22
password
=
seetatech
for
ip
in
${
new_node
[@]
}
do
sshpass -p
$password
ssh-copy-id -i ~/.ssh/id_rsa.pub -p
$port
-o
StrictHostKeyChecking
=
no root@
$ip
done
##############根据new_node节点清单自动配置ansible hosts########
for
ansible_new_node
in
${
new_node
[@]
}
do
if
! grep -qF
"
$ansible_new_node
"
/etc/hosts;
then
cat >>./hosts
<<EOF
$ip
EOF
else
echo
"您已配置该node:
$ip
信息到ansible hosts文件,已跳过该步骤"
fi
done
########################################
ansible new_node -m script -a
"/root/k8s/script/k8s/backup/1-init.sh"
ansible new_node -m shell -a
"mkdir /opt/kubernetes/{cfg,bin,ssl,log} -pv"
...
...
@@ -35,7 +45,7 @@ ansible new_node -m shell -a "systemctl daemon-reload"
ansible new_node -m shell -a
"service flanneld restart"
ansible new_node -m shell -a
"service flanneld status"
ansible new_node -m shell -a
"systemctl enable flanneld.service"
#############################docker############################################
#############################
安装
docker############################################
echo
"当前harbor仓库地址为
$harbor_host
,"
sed -i s/harbor_host/
$harbor_host
/g /root/k8s/config/daemon.json
echo
"开始安装docker"
...
...
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