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
c16f41f5
Commit
c16f41f5
authored
Sep 30, 2015
by
Kevin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change minion to node in centos baremetal scripts
and remove unused variable `MINIONS_ARRAY` in config-default
parent
dd827217
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
35 deletions
+34
-35
config-default.sh
cluster/centos/config-default.sh
+5
-5
util.sh
cluster/centos/util.sh
+29
-30
No files found.
cluster/centos/config-default.sh
View file @
c16f41f5
...
@@ -22,13 +22,13 @@ export MASTER_IP=${MASTER#*@}
...
@@ -22,13 +22,13 @@ export MASTER_IP=${MASTER#*@}
# Define all your minion nodes,
# Define all your minion nodes,
# And separated with blank space like <user_1@ip_1> <user_2@ip_2> <user_3@ip_3>.
# And separated with blank space like <user_1@ip_1> <user_2@ip_2> <user_3@ip_3>.
# The user should have sudo privilege
# The user should have sudo privilege
export
MINIONS
=
${
MINIONS
:-
"centos@172.10.0.12 centos@172.10.0.13"
}
export
NODES
=
${
NODES
:-
"centos@172.10.0.12 centos@172.10.0.13"
}
# If it practically impossible to set an array as an environment variable
# from a script, so assume variable is a string then convert it to an array
export
MINIONS_ARRAY
=(
$MINIONS
)
# Number of nodes in your cluster.
# Number of nodes in your cluster.
export
NUM_MINIONS
=
${
NUM_MINIONS
:-
2
}
export
NUM_NODES
=
${
NUM_NODES
:-
2
}
# Should be removed when NUM_MINIONS is deprecated in validate-cluster.sh
export
NUM_MINIONS
=
${
NUM_NODES
}
# By default, the cluster will use the etcd installed on master.
# By default, the cluster will use the etcd installed on master.
export
ETCD_SERVERS
=
${
ETCD_SERVERS
:-
"http://
$MASTER_IP
:4001"
}
export
ETCD_SERVERS
=
${
ETCD_SERVERS
:-
"http://
$MASTER_IP
:4001"
}
...
...
cluster/centos/util.sh
View file @
c16f41f5
...
@@ -31,7 +31,7 @@ source "$KUBE_ROOT/cluster/common.sh"
...
@@ -31,7 +31,7 @@ source "$KUBE_ROOT/cluster/common.sh"
KUBECTL_PATH
=
${
KUBE_ROOT
}
/cluster/centos/binaries/kubectl
KUBECTL_PATH
=
${
KUBE_ROOT
}
/cluster/centos/binaries/kubectl
# Directory to be used for master and
minion
provisioning.
# Directory to be used for master and
node
provisioning.
KUBE_TEMP
=
"~/kube_temp"
KUBE_TEMP
=
"~/kube_temp"
...
@@ -43,13 +43,13 @@ function detect-master() {
...
@@ -43,13 +43,13 @@ function detect-master() {
echo
"KUBE_MASTER:
${
MASTER
}
"
1>&2
echo
"KUBE_MASTER:
${
MASTER
}
"
1>&2
}
}
# Get
minion IP addresses and store in KUBE_MINION
_IP_ADDRESSES[]
# Get
node IP addresses and store in KUBE_NODE
_IP_ADDRESSES[]
function
detect-
minion
s
()
{
function
detect-
node
s
()
{
KUBE_
MINION
_IP_ADDRESSES
=()
KUBE_
NODE
_IP_ADDRESSES
=()
for
minion
in
${
MINION
S
}
;
do
for
node
in
${
NODE
S
}
;
do
KUBE_
MINION_IP_ADDRESSES+
=(
"
${
minion
#*@
}
"
)
KUBE_
NODE_IP_ADDRESSES+
=(
"
${
node
#*@
}
"
)
done
done
echo
"KUBE_
MINION_IP_ADDRESSES: [
${
KUBE_MINION
_IP_ADDRESSES
[*]
}
]"
1>&2
echo
"KUBE_
NODE_IP_ADDRESSES: [
${
KUBE_NODE
_IP_ADDRESSES
[*]
}
]"
1>&2
}
}
# Verify prereqs on host machine
# Verify prereqs on host machine
...
@@ -100,8 +100,8 @@ function validate-cluster() {
...
@@ -100,8 +100,8 @@ function validate-cluster() {
"
${
KUBE_ROOT
}
/cluster/validate-cluster.sh"
"
${
KUBE_ROOT
}
/cluster/validate-cluster.sh"
if
[[
"
$?
"
-ne
"0"
]]
;
then
if
[[
"
$?
"
-ne
"0"
]]
;
then
troubleshoot-master
troubleshoot-master
for
minion
in
${
MINION
S
}
;
do
for
node
in
${
NODE
S
}
;
do
troubleshoot-
minion
${
minion
}
troubleshoot-
node
${
node
}
done
done
exit
1
exit
1
fi
fi
...
@@ -112,8 +112,8 @@ function validate-cluster() {
...
@@ -112,8 +112,8 @@ function validate-cluster() {
function
kube-up
()
{
function
kube-up
()
{
provision-master
provision-master
for
minion
in
${
MINION
S
}
;
do
for
node
in
${
NODE
S
}
;
do
provision-
minion
${
minion
}
provision-
node
${
node
}
done
done
detect-master
detect-master
...
@@ -131,8 +131,8 @@ function kube-up() {
...
@@ -131,8 +131,8 @@ function kube-up() {
# Delete a kubernetes cluster
# Delete a kubernetes cluster
function
kube-down
()
{
function
kube-down
()
{
tear-down-master
tear-down-master
for
minion
in
${
MINION
S
}
;
do
for
node
in
${
NODE
S
}
;
do
tear-down-
minion
${
minion
}
tear-down-
node
${
node
}
done
done
}
}
...
@@ -156,9 +156,9 @@ function troubleshoot-master() {
...
@@ -156,9 +156,9 @@ function troubleshoot-master() {
printf
"
\n
"
printf
"
\n
"
}
}
function
troubleshoot-
minion
()
{
function
troubleshoot-
node
()
{
# Troubleshooting on
minion
if all required daemons are active.
# Troubleshooting on
node
if all required daemons are active.
echo
"[INFO] Troubleshooting on
minion
${
1
}
"
echo
"[INFO] Troubleshooting on
node
${
1
}
"
local
-a
required_daemon
=(
"kube-proxy"
"kubelet"
"docker"
"flannel"
)
local
-a
required_daemon
=(
"kube-proxy"
"kubelet"
"docker"
"flannel"
)
local
daemon
local
daemon
local
daemon_status
local
daemon_status
...
@@ -193,9 +193,9 @@ echo "[INFO] tear-down-master on ${MASTER}"
...
@@ -193,9 +193,9 @@ echo "[INFO] tear-down-master on ${MASTER}"
kube-ssh
"
${
MASTER
}
"
"sudo rm -rf /var/lib/etcd"
kube-ssh
"
${
MASTER
}
"
"sudo rm -rf /var/lib/etcd"
}
}
# Clean up on
minion
# Clean up on
node
function
tear-down-
minion
()
{
function
tear-down-
node
()
{
echo
"[INFO] tear-down-
minion
on
$1
"
echo
"[INFO] tear-down-
node
on
$1
"
for
service_name
in
kube-proxy kubelet docker flannel
;
do
for
service_name
in
kube-proxy kubelet docker flannel
;
do
service_file
=
"/usr/lib/systemd/system/
${
service_name
}
.service"
service_file
=
"/usr/lib/systemd/system/
${
service_name
}
.service"
kube-ssh
"
$1
"
"
\
kube-ssh
"
$1
"
"
\
...
@@ -235,30 +235,29 @@ function provision-master() {
...
@@ -235,30 +235,29 @@ function provision-master() {
}
}
# Provision
minion
# Provision
node
#
#
# Assumed vars:
# Assumed vars:
# $1 (
minion
)
# $1 (
node
)
# MASTER
# MASTER
# KUBE_TEMP
# KUBE_TEMP
# ETCD_SERVERS
# ETCD_SERVERS
# FLANNEL_NET
# FLANNEL_NET
# DOCKER_OPTS
# DOCKER_OPTS
function
provision-
minion
()
{
function
provision-
node
()
{
echo
"[INFO] Provision
minion
on
$1
"
echo
"[INFO] Provision
node
on
$1
"
local
master_ip
=
${
MASTER
#*@
}
local
master_ip
=
${
MASTER
#*@
}
local
minion
=
$1
local
node
=
$1
local
minion_ip
=
${
minion
#*@
}
local
node_ip
=
${
node
#*@
}
ensure-setup-dir
${
minion
}
ensure-setup-dir
${
node
}
# scp -r ${SSH_OPTS} minion config-default.sh copy-files.sh util.sh "${minion_ip}:${KUBE_TEMP}"
kube-scp
${
node
}
"
${
ROOT
}
/binaries/node
${
ROOT
}
/node
${
ROOT
}
/config-default.sh
${
ROOT
}
/util.sh"
${
KUBE_TEMP
}
kube-scp
${
minion
}
"
${
ROOT
}
/binaries/node
${
ROOT
}
/node
${
ROOT
}
/config-default.sh
${
ROOT
}
/util.sh"
${
KUBE_TEMP
}
kube-ssh
"
${
node
}
"
"
\
kube-ssh
"
${
minion
}
"
"
\
sudo cp -r
${
KUBE_TEMP
}
/node/bin /opt/kubernetes;
\
sudo cp -r
${
KUBE_TEMP
}
/node/bin /opt/kubernetes;
\
sudo chmod -R +x /opt/kubernetes/bin;
\
sudo chmod -R +x /opt/kubernetes/bin;
\
sudo bash
${
KUBE_TEMP
}
/node/scripts/flannel.sh
${
ETCD_SERVERS
}
${
FLANNEL_NET
}
;
\
sudo bash
${
KUBE_TEMP
}
/node/scripts/flannel.sh
${
ETCD_SERVERS
}
${
FLANNEL_NET
}
;
\
sudo bash
${
KUBE_TEMP
}
/node/scripts/docker.sh
\"
${
DOCKER_OPTS
}
\"
;
\
sudo bash
${
KUBE_TEMP
}
/node/scripts/docker.sh
\"
${
DOCKER_OPTS
}
\"
;
\
sudo bash
${
KUBE_TEMP
}
/node/scripts/kubelet.sh
${
master_ip
}
${
minion
_ip
}
;
\
sudo bash
${
KUBE_TEMP
}
/node/scripts/kubelet.sh
${
master_ip
}
${
node
_ip
}
;
\
sudo bash
${
KUBE_TEMP
}
/node/scripts/proxy.sh
${
master_ip
}
"
sudo bash
${
KUBE_TEMP
}
/node/scripts/proxy.sh
${
master_ip
}
"
}
}
...
...
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