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
2a655595
Commit
2a655595
authored
Sep 30, 2015
by
eulerzgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change minion to node for libvirt-coreos
parent
e97483ae
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
32 deletions
+32
-32
config-default.sh
cluster/libvirt-coreos/config-default.sh
+13
-13
user_data.yml
cluster/libvirt-coreos/user_data.yml
+2
-2
user_data_minion.yml
cluster/libvirt-coreos/user_data_minion.yml
+1
-1
util.sh
cluster/libvirt-coreos/util.sh
+16
-16
No files found.
cluster/libvirt-coreos/config-default.sh
View file @
2a655595
...
...
@@ -26,25 +26,25 @@ export MASTER_IP="192.168.10.1"
export
INSTANCE_PREFIX
=
kubernetes
export
MASTER_NAME
=
"
${
INSTANCE_PREFIX
}
-master"
# Map out the IPs, names and container subnets of each
minion
export
MINION
_IP_BASE
=
"192.168.10."
MINION
_CONTAINER_SUBNET_BASE
=
"10.10"
# Map out the IPs, names and container subnets of each
node
export
NODE
_IP_BASE
=
"192.168.10."
NODE
_CONTAINER_SUBNET_BASE
=
"10.10"
MASTER_CONTAINER_NETMASK
=
"255.255.255.0"
MASTER_CONTAINER_ADDR
=
"
${
MINION
_CONTAINER_SUBNET_BASE
}
.0.1"
MASTER_CONTAINER_SUBNET
=
"
${
MINION
_CONTAINER_SUBNET_BASE
}
.0.1/24"
CONTAINER_SUBNET
=
"
${
MINION
_CONTAINER_SUBNET_BASE
}
.0.0/16"
MASTER_CONTAINER_ADDR
=
"
${
NODE
_CONTAINER_SUBNET_BASE
}
.0.1"
MASTER_CONTAINER_SUBNET
=
"
${
NODE
_CONTAINER_SUBNET_BASE
}
.0.1/24"
CONTAINER_SUBNET
=
"
${
NODE
_CONTAINER_SUBNET_BASE
}
.0.0/16"
if
[[
"
$NUM_MINIONS
"
-gt
253
]]
;
then
echo
"ERROR: Because of how IPs are allocated in
${
BASH_SOURCE
}
, you cannot create more than 253
minion
s"
echo
"ERROR: Because of how IPs are allocated in
${
BASH_SOURCE
}
, you cannot create more than 253
node
s"
exit
1
fi
for
((
i
=
0
;
i < NUM_MINIONS
;
i++
))
do
MINION_IPS[
$i
]=
"
${
MINION
_IP_BASE
}$((
i+2
))
"
MINION_NAMES[
$i
]=
"
${
INSTANCE_PREFIX
}
-minion
-
$((
i+1
))
"
MINION_CONTAINER_SUBNETS[
$i
]=
"
${
MINION
_CONTAINER_SUBNET_BASE
}
.
$((
i+1
))
.1/24"
MINION_CONTAINER_ADDRS[
$i
]=
"
${
MINION
_CONTAINER_SUBNET_BASE
}
.
$((
i+1
))
.1"
MINION
_CONTAINER_NETMASKS[
$i
]=
"255.255.255.0"
NODE_IPS[
$i
]=
"
${
NODE
_IP_BASE
}$((
i+2
))
"
NODE_NAMES[
$i
]=
"
${
INSTANCE_PREFIX
}
-node
-
$((
i+1
))
"
NODE_CONTAINER_SUBNETS[
$i
]=
"
${
NODE
_CONTAINER_SUBNET_BASE
}
.
$((
i+1
))
.1/24"
NODE_CONTAINER_ADDRS[
$i
]=
"
${
NODE
_CONTAINER_SUBNET_BASE
}
.
$((
i+1
))
.1"
NODE
_CONTAINER_NETMASKS[
$i
]=
"255.255.255.0"
done
MINION
_CONTAINER_SUBNETS[
$NUM_MINIONS
]=
$MASTER_CONTAINER_SUBNET
NODE
_CONTAINER_SUBNETS[
$NUM_MINIONS
]=
$MASTER_CONTAINER_SUBNET
SERVICE_CLUSTER_IP_RANGE
=
10.11.0.0/16
# formerly PORTAL_NET
...
...
cluster/libvirt-coreos/user_data.yml
View file @
2a655595
...
...
@@ -46,7 +46,7 @@ coreos:
Name=cbr0
[Network]
Address=${
MINION
_CONTAINER_SUBNETS[$i]}
Address=${
NODE
_CONTAINER_SUBNETS[$i]}
[Route]
Destination=${CONTAINER_SUBNET}
...
...
@@ -113,4 +113,4 @@ coreos:
reboot-strategy
:
off
$( [[ ${type} =~ "master" ]] && render-template "$ROOT/user_data_master.yml" )
$( [[ ${type} =~ "
minion
" ]] && render-template "$ROOT/user_data_minion.yml" )
$( [[ ${type} =~ "
node
" ]] && render-template "$ROOT/user_data_minion.yml" )
cluster/libvirt-coreos/user_data_minion.yml
View file @
2a655595
...
...
@@ -15,7 +15,7 @@ coreos:
[Service]
ExecStart=/opt/kubernetes/bin/kubelet \
--address=0.0.0.0 \
--hostname-override=${
MINION
_IPS[$i]} \
--hostname-override=${
NODE
_IPS[$i]} \
--api-servers=http://${MASTER_IP}:8080 \
$( [[ "$ENABLE_CLUSTER_DNS" == "true" ]] && echo "--cluster-dns=${DNS_SERVER_IP}" ) \
$( [[ "$ENABLE_CLUSTER_DNS" == "true" ]] && echo "--cluster-domain=${DNS_DOMAIN}" ) \
...
...
cluster/libvirt-coreos/util.sh
View file @
2a655595
...
...
@@ -46,9 +46,9 @@ function detect-master {
echo
"KUBE_MASTER:
$KUBE_MASTER
"
}
# Get
minion IP addresses and store in KUBE_MINION
_IP_ADDRESSES[]
function
detect-
minion
s
{
KUBE_
MINION_IP_ADDRESSES
=(
"
${
MINION
_IPS
[@]
}
"
)
# Get
node IP addresses and store in KUBE_NODE
_IP_ADDRESSES[]
function
detect-
node
s
{
KUBE_
NODE_IP_ADDRESSES
=(
"
${
NODE
_IPS
[@]
}
"
)
}
# Verify prereqs on host machine
...
...
@@ -166,9 +166,9 @@ function wait-cluster-readiness {
local timeout
=
120
while
[[
$timeout
-ne
0
]]
;
do
nb_ready_
minion
s
=
$(
"
${
kubectl
}
"
get nodes
-o
go-template
=
"{{range.items}}{{range.status.conditions}}{{.type}}{{end}}:{{end}}"
--api-version
=
v1 2>/dev/null |
tr
':'
'\n'
|
grep
-c
Ready
||
true
)
echo
"Nb ready
minions:
$nb_ready_minion
s
/
$NUM_MINIONS
"
if
[[
"
$nb_ready_
minion
s
"
-eq
"
$NUM_MINIONS
"
]]
;
then
nb_ready_
node
s
=
$(
"
${
kubectl
}
"
get nodes
-o
go-template
=
"{{range.items}}{{range.status.conditions}}{{.type}}{{end}}:{{end}}"
--api-version
=
v1 2>/dev/null |
tr
':'
'\n'
|
grep
-c
Ready
||
true
)
echo
"Nb ready
nodes:
$nb_ready_node
s
/
$NUM_MINIONS
"
if
[[
"
$nb_ready_
node
s
"
-eq
"
$NUM_MINIONS
"
]]
;
then
return
0
fi
...
...
@@ -182,7 +182,7 @@ function wait-cluster-readiness {
# Instantiate a kubernetes cluster
function
kube-up
{
detect-master
detect-
minion
s
detect-
node
s
gen-kube-bearertoken
initialize-pool keep_base_image
initialize-network
...
...
@@ -195,11 +195,11 @@ function kube-up {
if
[[
$i
-eq
$NUM_MINIONS
]]
;
then
etcd2_initial_cluster[
$i
]=
"
${
MASTER_NAME
}
=http://
${
MASTER_IP
}
:2380"
else
etcd2_initial_cluster[
$i
]=
"
${
MINION_NAMES
[
$i
]
}
=http://
${
MINION
_IPS
[
$i
]
}
:2380"
etcd2_initial_cluster[
$i
]=
"
${
NODE_NAMES
[
$i
]
}
=http://
${
NODE
_IPS
[
$i
]
}
:2380"
fi
done
etcd2_initial_cluster
=
$(
join
,
"
${
etcd2_initial_cluster
[@]
}
"
)
readonly
machines
=
$(
join
,
"
${
KUBE_
MINION
_IP_ADDRESSES
[@]
}
"
)
readonly
machines
=
$(
join
,
"
${
KUBE_
NODE
_IP_ADDRESSES
[@]
}
"
)
for
((
i
=
0
;
i <
=
$NUM_MINIONS
;
i++
))
;
do
if
[[
$i
-eq
$NUM_MINIONS
]]
;
then
...
...
@@ -207,9 +207,9 @@ function kube-up {
name
=
$MASTER_NAME
public_ip
=
$MASTER_IP
else
type
=
minion
-
$(
printf
"%02d"
$i
)
name
=
${
MINION
_NAMES
[
$i
]
}
public_ip
=
${
MINION
_IPS
[
$i
]
}
type
=
node
-
$(
printf
"%02d"
$i
)
name
=
${
NODE
_NAMES
[
$i
]
}
public_ip
=
${
NODE
_IPS
[
$i
]
}
fi
image
=
$name
.img
config
=
kubernetes_config_
$type
...
...
@@ -263,7 +263,7 @@ function kube-push {
kube-push-internal
ssh-to-node
"
$MASTER_NAME
"
"sudo systemctl restart kube-apiserver kube-controller-manager kube-scheduler"
for
((
i
=
0
;
i < NUM_MINIONS
;
i++
))
;
do
ssh-to-node
"
${
MINION
_NAMES
[
$i
]
}
"
"sudo systemctl restart kubelet kube-proxy"
ssh-to-node
"
${
NODE
_NAMES
[
$i
]
}
"
"sudo systemctl restart kubelet kube-proxy"
done
wait-cluster-readiness
}
...
...
@@ -312,14 +312,14 @@ function ssh-to-node {
local
cmd
=
"
$2
"
local
machine
if
[[
"
$node
"
==
"
$MASTER_IP
"
]]
||
[[
"
$node
"
=
~ ^
"
$
MINION
_IP_BASE
"
]]
;
then
if
[[
"
$node
"
==
"
$MASTER_IP
"
]]
||
[[
"
$node
"
=
~ ^
"
$
NODE
_IP_BASE
"
]]
;
then
machine
=
"
$node
"
elif
[[
"
$node
"
==
"
$MASTER_NAME
"
]]
;
then
machine
=
"
$MASTER_IP
"
else
for
((
i
=
0
;
i < NUM_MINIONS
;
i++
))
;
do
if
[[
"
$node
"
==
"
${
MINION
_NAMES
[
$i
]
}
"
]]
;
then
machine
=
"
${
MINION
_IPS
[
$i
]
}
"
if
[[
"
$node
"
==
"
${
NODE
_NAMES
[
$i
]
}
"
]]
;
then
machine
=
"
${
NODE
_IPS
[
$i
]
}
"
break
fi
done
...
...
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