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
9077c232
Commit
9077c232
authored
Feb 27, 2015
by
Lénaïc Huard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libvirt-coreos: move all IP definitions in config-default.sh
parent
93c00522
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
17 deletions
+45
-17
config-default.sh
cluster/libvirt-coreos/config-default.sh
+28
-0
user_data.yml
cluster/libvirt-coreos/user_data.yml
+6
-6
user_data_master.yml
cluster/libvirt-coreos/user_data_master.yml
+1
-1
user_data_minion.yml
cluster/libvirt-coreos/user_data_minion.yml
+2
-2
util.sh
cluster/libvirt-coreos/util.sh
+8
-8
No files found.
cluster/libvirt-coreos/config-default.sh
View file @
9077c232
...
...
@@ -19,3 +19,31 @@
# Number of minions in the cluster
NUM_MINIONS
=
${
NUM_MINIONS
:-
3
}
export
NUM_MINIONS
# The IP of the master
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"
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"
if
[[
"
$NUM_MINIONS
"
-gt
253
]]
;
then
echo
"ERROR: Because of how IPs are allocated in
${
BASH_SOURCE
}
, you cannot create more than 253 minions"
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"
done
MINION_CONTAINER_SUBNETS[
$NUM_MINIONS
]=
$MASTER_CONTAINER_SUBNET
PORTAL_NET
=
10.11.0.0/16
cluster/libvirt-coreos/user_data.yml
View file @
9077c232
...
...
@@ -16,9 +16,9 @@ write_files:
coreos
:
etcd
:
name
:
${name}
addr
:
192.168.10.$(($i+1))
:4001
addr
:
${public_ip}
:4001
bind-addr
:
0.0.0.0
peer-addr
:
192.168.10.$(($i+1))
:7001
peer-addr
:
${public_ip}
:7001
# peers: {etcd_peers}
discovery
:
${discovery}
units
:
...
...
@@ -30,7 +30,7 @@ coreos:
MACAddress=52:54:00:00:00:${i}
[Network]
Address=
192.168.10.$(($i+1))
/24
Address=
${public_ip}
/24
DNS=192.168.10.254
Gateway=192.168.10.254
-
name
:
cbr0.netdev
...
...
@@ -46,10 +46,10 @@ coreos:
Name=cbr0
[Network]
Address=
10.10.$(($i+1)).1/24
Address=
${MINION_CONTAINER_SUBNETS[$i]}
[Route]
Destination=
10.10.0.0/16
Destination=
${CONTAINER_SUBNET}
-
name
:
cbr0-interface.network
command
:
start
content
:
|
...
...
@@ -66,7 +66,7 @@ coreos:
Description=NAT non container traffic
[Service]
ExecStart=/usr/sbin/iptables -w -t nat -A POSTROUTING -o eth0 -j MASQUERADE ! -d
10.10.0.0/16
ExecStart=/usr/sbin/iptables -w -t nat -A POSTROUTING -o eth0 -j MASQUERADE ! -d
${CONTAINER_SUBNET}
RemainAfterExit=yes
Type=oneshot
-
name
:
etcd.service
...
...
cluster/libvirt-coreos/user_data_master.yml
View file @
9077c232
...
...
@@ -18,7 +18,7 @@ coreos:
--port=8080 \
--etcd_servers=http://127.0.0.1:4001 \
--kubelet_port=10250 \
--portal_net=
10.10.254.0/24
--portal_net=
${PORTAL_NET}
Restart=always
RestartSec=2
...
...
cluster/libvirt-coreos/user_data_minion.yml
View file @
9077c232
...
...
@@ -15,7 +15,7 @@ coreos:
[Service]
ExecStart=/opt/kubernetes/bin/kubelet \
--address=0.0.0.0 \
--hostname_override=
192.168.10.$(($i+1))
\
--hostname_override=
${MINION_IPS[$i]}
\
--etcd_servers=http://127.0.0.1:4001
Restart=always
RestartSec=2
...
...
@@ -35,7 +35,7 @@ coreos:
[Service]
ExecStart=/opt/kubernetes/bin/kube-proxy \
--etcd_servers=http://127.0.0.1:4001 \
--master=http://
192.168.10.1
:7080
--master=http://
${MASTER_IP}
:7080
Restart=always
RestartSec=2
...
...
cluster/libvirt-coreos/util.sh
View file @
9077c232
...
...
@@ -38,8 +38,8 @@ function join {
# Must ensure that the following ENV vars are set
function
detect-master
{
KUBE_MASTER_IP
=
192.168.10.1
KUBE_MASTER
=
kubernetes-master
KUBE_MASTER_IP
=
$MASTER_IP
KUBE_MASTER
=
$MASTER_NAME
export
KUBERNETES_MASTER
=
http://
$KUBE_MASTER_IP
:8080
echo
"KUBE_MASTER_IP:
$KUBE_MASTER_IP
"
echo
"KUBE_MASTER:
$KUBE_MASTER
"
...
...
@@ -47,10 +47,7 @@ function detect-master {
# Get minion IP addresses and store in KUBE_MINION_IP_ADDRESSES[]
function
detect-minions
{
for
((
i
=
0
;
i <
$NUM_MINIONS
;
i++
))
;
do
KUBE_MINION_IP_ADDRESSES[
$i
]=
192.168.10.
$((
$i
+
2
))
done
echo
"KUBE_MINION_IP_ADDRESSES=[
${
KUBE_MINION_IP_ADDRESSES
[@]
}
]"
KUBE_MINION_IP_ADDRESSES
=(
"
${
MINION_IPS
[@]
}
"
)
}
# Verify prereqs on host machine
...
...
@@ -161,12 +158,15 @@ function kube-up {
local
i
for
((
i
=
0
;
i <
=
$NUM_MINIONS
;
i++
))
;
do
if
[[
$i
-eq
0
]]
;
then
if
[[
$i
-eq
$NUM_MINIONS
]]
;
then
type
=
master
name
=
$MASTER_NAME
public_ip
=
$MASTER_IP
else
type
=
minion-
$(
printf
"%02d"
$i
)
name
=
${
MINION_NAMES
[
$i
]
}
public_ip
=
${
MINION_IPS
[
$i
]
}
fi
name
=
kubernetes_
$type
image
=
$name
.img
config
=
kubernetes_config_
$type
...
...
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