Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
8600e3f2
Commit
8600e3f2
authored
Sep 23, 2015
by
Eric Tune
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14412 from zhengguoyong/update-minion-to-node
change minion to node
parents
f899afb8
6e92c939
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
33 deletions
+33
-33
util.sh
cluster/ubuntu/util.sh
+33
-33
No files found.
cluster/ubuntu/util.sh
View file @
8600e3f2
...
...
@@ -21,7 +21,7 @@ SSH_OPTS="-oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oLogLevel=E
MASTER
=
""
MASTER_IP
=
""
MINION
_IPS
=
""
NODE
_IPS
=
""
# Assumed Vars:
# KUBE_ROOT
...
...
@@ -32,11 +32,11 @@ function test-build-release {
# From user input set the necessary k8s and etcd configuration information
function
setClusterInfo
()
{
# Initialize
MINION
_IPS in setClusterInfo function
#
MINION_IPS is defined as a global variable, and is concatenated with other nodeIP
# Initialize
NODE
_IPS in setClusterInfo function
#
NODE_IPS is defined as a global variable, and is concatenated with other nodeIP
# When setClusterInfo is called for many times, this could cause potential problems
# Such as, you will have
MINION
_IPS=192.168.0.2,192.168.0.3,192.168.0.2,192.168.0.3 which is obviously wrong
MINION
_IPS
=
""
# Such as, you will have
NODE
_IPS=192.168.0.2,192.168.0.3,192.168.0.2,192.168.0.3 which is obviously wrong
NODE
_IPS
=
""
ii
=
0
for
i
in
$nodes
;
do
...
...
@@ -45,15 +45,15 @@ function setClusterInfo() {
if
[[
"
${
roles
[
${
ii
}
]
}
"
==
"ai"
]]
;
then
MASTER_IP
=
$nodeIP
MASTER
=
$i
MINION
_IPS
=
"
$nodeIP
"
NODE
_IPS
=
"
$nodeIP
"
elif
[[
"
${
roles
[
${
ii
}
]
}
"
==
"a"
]]
;
then
MASTER_IP
=
$nodeIP
MASTER
=
$i
elif
[[
"
${
roles
[
${
ii
}
]
}
"
==
"i"
]]
;
then
if
[[
-z
"
${
MINION
_IPS
}
"
]]
;
then
MINION
_IPS
=
"
$nodeIP
"
if
[[
-z
"
${
NODE
_IPS
}
"
]]
;
then
NODE
_IPS
=
"
$nodeIP
"
else
MINION_IPS
=
"
$MINION
_IPS
,
$nodeIP
"
NODE_IPS
=
"
$NODE
_IPS
,
$nodeIP
"
fi
else
echo
"unsupported role for
${
i
}
. please check"
...
...
@@ -115,10 +115,10 @@ function verify-cluster {
if
[
"
${
roles
[
${
ii
}
]
}
"
==
"a"
]
;
then
verify-master
elif
[
"
${
roles
[
${
ii
}
]
}
"
==
"i"
]
;
then
verify-
minion
$i
verify-
node
$i
elif
[
"
${
roles
[
${
ii
}
]
}
"
==
"ai"
]
;
then
verify-master
verify-
minion
$i
verify-
node
$i
else
echo
"unsupported role for
${
i
}
. please check"
exit
1
...
...
@@ -155,8 +155,8 @@ function verify-master(){
}
function
verify-
minion
(){
# verify
minion
has all required daemons
function
verify-
node
(){
# verify
node
has all required daemons
printf
"Validating
${
1
}
"
local
-a
required_daemon
=(
"kube-proxy"
"kubelet"
"docker"
)
local
validated
=
"1"
...
...
@@ -257,30 +257,30 @@ function detect-master {
echo
"Using master
$MASTER_IP
"
}
# Detect the information about the
minion
s
# Detect the information about the
node
s
#
# Assumed vars:
# nodes
# Vars set:
# KUBE_
MINION
_IP_ADDRESS (array)
function
detect-
minion
s
{
# KUBE_
NODE
_IP_ADDRESS (array)
function
detect-
node
s
{
source
"
${
KUBE_ROOT
}
/cluster/ubuntu/
${
KUBE_CONFIG_FILE
-
"config-default.sh"
}
"
KUBE_
MINION
_IP_ADDRESSES
=()
KUBE_
NODE
_IP_ADDRESSES
=()
setClusterInfo
ii
=
0
for
i
in
${
nodes
}
do
if
[
"
${
roles
[
${
ii
}
]
}
"
==
"i"
]
||
[
"
${
roles
[
${
ii
}
]
}
"
==
"ai"
]
;
then
KUBE_
MINION
_IP_ADDRESSES+
=(
"
${
i
#*@
}
"
)
KUBE_
NODE
_IP_ADDRESSES+
=(
"
${
i
#*@
}
"
)
fi
((
ii
=
ii+1
))
done
if
[[
-z
"
${
KUBE_
MINION
_IP_ADDRESSES
[@]
}
"
]]
;
then
echo
"Could not detect Kubernetes
minion
nodes. Make sure you've launched a cluster with 'kube-up.sh'"
>
&2
if
[[
-z
"
${
KUBE_
NODE
_IP_ADDRESSES
[@]
}
"
]]
;
then
echo
"Could not detect Kubernetes
node
nodes. Make sure you've launched a cluster with 'kube-up.sh'"
>
&2
exit
1
fi
}
...
...
@@ -304,9 +304,9 @@ function kube-up() {
if
[
"
${
roles
[
${
ii
}
]
}
"
==
"a"
]
;
then
provision-master
elif
[
"
${
roles
[
${
ii
}
]
}
"
==
"ai"
]
;
then
provision-masterand
minion
provision-masterand
node
elif
[
"
${
roles
[
${
ii
}
]
}
"
==
"i"
]
;
then
provision-
minion
$i
provision-
node
$i
else
echo
"unsupported role for
${
i
}
. please check"
exit
1
...
...
@@ -342,7 +342,7 @@ function provision-master() {
setClusterInfo;
\
create-etcd-opts;
\
create-kube-apiserver-opts "
${
SERVICE_CLUSTER_IP_RANGE
}
" "
${
ADMISSION_CONTROL
}
" "
${
SERVICE_NODE_PORT_RANGE
}
";
\
create-kube-controller-manager-opts "
${
MINION
_IPS
}
";
\
create-kube-controller-manager-opts "
${
NODE
_IPS
}
";
\
create-kube-scheduler-opts;
\
create-flanneld-opts "
127.0.0.1
";
\
sudo -p '[sudo] password to start master: ' cp ~/kube/default/* /etc/default/ && sudo cp ~/kube/init_conf/* /etc/init/ && sudo cp ~/kube/init_scripts/* /etc/init.d/ ;
\
...
...
@@ -353,9 +353,9 @@ function provision-master() {
sudo FLANNEL_NET=
${
FLANNEL_NET
}
-b ~/kube/reconfDocker.sh "
a
";"
}
function
provision-
minion
()
{
# copy the binaries and scripts to the ~/kube directory on the
minion
echo
"Deploying
minion
on machine
${
1
#*@
}
"
function
provision-
node
()
{
# copy the binaries and scripts to the ~/kube directory on the
node
echo
"Deploying
node
on machine
${
1
#*@
}
"
echo
ssh
$SSH_OPTS
$1
"mkdir -p ~/kube/default"
scp
-r
$SSH_OPTS
ubuntu/config-default.sh ubuntu/util.sh ubuntu/reconfDocker.sh ubuntu/minion/
*
ubuntu/binaries/minion
"
${
1
}
:~/kube"
...
...
@@ -372,9 +372,9 @@ function provision-minion() {
sudo -b ~/kube/reconfDocker.sh "
i
";"
}
function
provision-masterand
minion
()
{
function
provision-masterand
node
()
{
# copy the binaries and scripts to the ~/kube directory on the master
echo
"Deploying master and
minion
on machine
${
MASTER_IP
}
"
echo
"Deploying master and
node
on machine
${
MASTER_IP
}
"
echo
ssh
$SSH_OPTS
$MASTER
"mkdir -p ~/kube/default"
# scp order matters
...
...
@@ -385,7 +385,7 @@ function provision-masterandminion() {
setClusterInfo;
\
create-etcd-opts;
\
create-kube-apiserver-opts "
${
SERVICE_CLUSTER_IP_RANGE
}
" "
${
ADMISSION_CONTROL
}
" "
${
SERVICE_NODE_PORT_RANGE
}
";
\
create-kube-controller-manager-opts "
${
MINION
_IPS
}
";
\
create-kube-controller-manager-opts "
${
NODE
_IPS
}
";
\
create-kube-scheduler-opts;
\
create-kubelet-opts "
${
MASTER_IP
}
" "
${
MASTER_IP
}
" "
${
DNS_SERVER_IP
}
" "
${
DNS_DOMAIN
}
";
create-kube-proxy-opts "
${
MASTER_IP
}
";
\
...
...
@@ -475,7 +475,7 @@ function push-master {
sudo rm -rf /etc/init/kube* /etc/init/flanneld.conf /etc/init.d/kube* /etc/init.d/flanneld;
sudo rm -rf /etc/default/kube* /etc/default/flanneld;
sudo rm -rf ~/kube'
||
true
provision-masterand
minion
provision-masterand
node
elif
[[
"
${
roles
[
${
ii
}
]
}
"
==
"i"
]]
;
then
((
ii
=
ii+1
))
continue
...
...
@@ -509,7 +509,7 @@ function push-node() {
sudo rm -rf /etc/init/kube* /etc/init/flanneld.conf /etc/init.d/kube* /etc/init.d/flanneld;
sudo rm -rf /etc/default/kube* /etc/default/flanneld;
sudo rm -rf ~/kube'
||
true
provision-
minion
$i
provision-
node
$i
existing
=
true
elif
[[
"
${
roles
[
${
ii
}
]
}
"
==
"a"
||
"
${
roles
[
${
ii
}
]
}
"
==
"ai"
]]
&&
[[
${
i
#*@
}
==
$node_ip
]]
;
then
echo
"
${
i
}
is master node, please try ./kube-push -m instead"
...
...
@@ -570,9 +570,9 @@ function kube-push {
if
[[
"
${
roles
[
${
ii
}
]
}
"
==
"a"
]]
;
then
provision-master
elif
[[
"
${
roles
[
${
ii
}
]
}
"
==
"i"
]]
;
then
provision-
minion
$i
provision-
node
$i
elif
[[
"
${
roles
[
${
ii
}
]
}
"
==
"ai"
]]
;
then
provision-masterand
minion
provision-masterand
node
else
echo
"unsupported role for
${
i
}
. please check"
exit
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment