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
fe7568d0
Commit
fe7568d0
authored
Feb 29, 2016
by
Dhawal Yogesh Bhanushali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cidr-fix for vsphere cloud provider
let kubelet configure cbr0 bridge. let kube-controll-manager distributed the subnet across the nodes. create routes for the pod network.
parent
c9bd9e9c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
14 deletions
+49
-14
top.sls
cluster/saltbase/salt/top.sls
+0
-4
config-default.sh
cluster/vsphere/config-default.sh
+2
-1
config-test.sh
cluster/vsphere/config-test.sh
+2
-1
create-dynamic-salt-files.sh
cluster/vsphere/templates/create-dynamic-salt-files.sh
+2
-1
salt-master.sh
cluster/vsphere/templates/salt-master.sh
+1
-0
salt-minion.sh
cluster/vsphere/templates/salt-minion.sh
+0
-1
util.sh
cluster/vsphere/util.sh
+42
-6
No files found.
cluster/saltbase/salt/top.sls
View file @
fe7568d0
...
@@ -80,7 +80,3 @@ base:
...
@@ -80,7 +80,3 @@ base:
{% if pillar.get('network_provider', '').lower() == 'opencontrail' %}
{% if pillar.get('network_provider', '').lower() == 'opencontrail' %}
- opencontrail-networking-master
- opencontrail-networking-master
{% endif %}
{% endif %}
'roles:kubernetes-pool-vsphere':
- match: grain
- static-routes
cluster/vsphere/config-default.sh
View file @
fe7568d0
...
@@ -27,7 +27,8 @@ MASTER_MEMORY_MB=1024
...
@@ -27,7 +27,8 @@ MASTER_MEMORY_MB=1024
MASTER_CPU
=
1
MASTER_CPU
=
1
NODE_NAMES
=(
$(
eval echo
${
INSTANCE_PREFIX
}
-minion-
{
1..
${
NUM_NODES
}
}
)
)
NODE_NAMES
=(
$(
eval echo
${
INSTANCE_PREFIX
}
-minion-
{
1..
${
NUM_NODES
}
}
)
)
NODE_IP_RANGES
=(
$(
eval echo
"10.244.{1..
${
NUM_NODES
}
}.0/24"
)
)
NODE_IP_RANGES
=
"10.244.0.0/16"
MASTER_IP_RANGE
=
"
${
MASTER_IP_RANGE
:-
10
.246.0.0/24
}
"
NODE_MEMORY_MB
=
2048
NODE_MEMORY_MB
=
2048
NODE_CPU
=
1
NODE_CPU
=
1
...
...
cluster/vsphere/config-test.sh
View file @
fe7568d0
...
@@ -27,7 +27,8 @@ MASTER_MEMORY_MB=1024
...
@@ -27,7 +27,8 @@ MASTER_MEMORY_MB=1024
MASTER_CPU
=
1
MASTER_CPU
=
1
NODE_NAMES
=(
$(
eval echo
${
INSTANCE_PREFIX
}
-minion-
{
1..
${
NUM_NODES
}
}
)
)
NODE_NAMES
=(
$(
eval echo
${
INSTANCE_PREFIX
}
-minion-
{
1..
${
NUM_NODES
}
}
)
)
NODE_IP_RANGES
=(
$(
eval echo
"10.244.{1..
${
NUM_NODES
}
}.0/24"
)
)
NODE_IP_RANGES
=
"10.244.0.0/16"
MASTER_IP_RANGE
=
"
${
MASTER_IP_RANGE
:-
10
.246.0.0/24
}
"
NODE_MEMORY_MB
=
1024
NODE_MEMORY_MB
=
1024
NODE_CPU
=
1
NODE_CPU
=
1
...
...
cluster/vsphere/templates/create-dynamic-salt-files.sh
View file @
fe7568d0
...
@@ -121,7 +121,8 @@ dns_replicas: ${DNS_REPLICAS:-1}
...
@@ -121,7 +121,8 @@ dns_replicas: ${DNS_REPLICAS:-1}
dns_server:
$DNS_SERVER_IP
dns_server:
$DNS_SERVER_IP
dns_domain:
$DNS_DOMAIN
dns_domain:
$DNS_DOMAIN
e2e_storage_test_environment: "
${
E2E_STORAGE_TEST_ENVIRONMENT
:-
false
}
"
e2e_storage_test_environment: "
${
E2E_STORAGE_TEST_ENVIRONMENT
:-
false
}
"
cluster_cidr: "
$NODE_IP_RANGES
"
allocate_node_cidrs: "
${
ALLOCATE_NODE_CIDRS
:-
true
}
"
EOF
EOF
mkdir
-p
/srv/salt-overlay/salt/nginx
mkdir
-p
/srv/salt-overlay/salt/nginx
...
...
cluster/vsphere/templates/salt-master.sh
View file @
fe7568d0
...
@@ -25,6 +25,7 @@ cat <<EOF >/etc/salt/minion.d/grains.conf
...
@@ -25,6 +25,7 @@ cat <<EOF >/etc/salt/minion.d/grains.conf
grains:
grains:
roles:
roles:
- kubernetes-master
- kubernetes-master
cbr-cidr:
$MASTER_IP_RANGE
cloud: vsphere
cloud: vsphere
EOF
EOF
...
...
cluster/vsphere/templates/salt-minion.sh
View file @
fe7568d0
...
@@ -41,7 +41,6 @@ grains:
...
@@ -41,7 +41,6 @@ grains:
roles:
roles:
- kubernetes-pool
- kubernetes-pool
- kubernetes-pool-vsphere
- kubernetes-pool-vsphere
cbr-cidr:
$NODE_IP_RANGE
cloud: vsphere
cloud: vsphere
EOF
EOF
...
...
cluster/vsphere/util.sh
View file @
fe7568d0
...
@@ -262,9 +262,6 @@ function kube-check {
...
@@ -262,9 +262,6 @@ function kube-check {
done
done
}
}
#
#
# verify if salt master is up. check 30 times and then echo out bad output and return 0
# verify if salt master is up. check 30 times and then echo out bad output and return 0
#
#
...
@@ -306,6 +303,41 @@ function remote-pgrep {
...
@@ -306,6 +303,41 @@ function remote-pgrep {
done
done
}
}
# identify the pod routes and route them together.
#
# Assumptions:
# All packages have been installed and kubelet has started running.
#
function
setup-pod-routes
{
# wait till the kubelet sets up the bridge.
echo
"Setting up routes"
for
((
i
=
0
;
i<
${#
NODE_NAMES
[@]
}
;
i++
))
;
do
printf
"check if cbr0 bridge is ready on
${
NODE_NAMES
[
$i
]
}
\n
"
kube-check
${
KUBE_NODE_IP_ADDRESSES
[
$i
]
}
'sudo ifconfig cbr0 | grep -oP "inet addr:\K\S+"'
done
# identify the subnet assigned to the node by the kubernertes controller manager.
KUBE_NODE_BRIDGE_NETWORK
=()
for
((
i
=
0
;
i<
${#
NODE_NAMES
[@]
}
;
i++
))
;
do
printf
" finding network of cbr0 bridge on node
${
NODE_NAMES
[
$i
]
}
\n
"
network
=
$(
kube-ssh
${
KUBE_NODE_IP_ADDRESSES
[
$i
]
}
'sudo ip route show | grep -E "dev cbr0" | cut -d " " -f1'
)
KUBE_NODE_BRIDGE_NETWORK+
=(
"
${
network
}
"
)
done
# make the pods visible to each other.
local
j
for
((
i
=
0
;
i<
${#
NODE_NAMES
[@]
}
;
i++
))
;
do
printf
"setting up routes for
${
NODE_NAMES
[
$i
]
}
"
for
((
j
=
0
;
j<
${#
NODE_NAMES
[@]
}
;
j++
))
;
do
if
[[
$i
!=
$j
]]
;
then
kube-ssh
${
KUBE_NODE_IP_ADDRESSES
[
$i
]
}
"sudo route add -net
${
KUBE_NODE_BRIDGE_NETWORK
[
$j
]
}
gw
${
KUBE_NODE_IP_ADDRESSES
[
$j
]
}
"
fi
done
done
}
# Instantiate a kubernetes cluster
# Instantiate a kubernetes cluster
#
#
# Assumed vars:
# Assumed vars:
...
@@ -331,8 +363,10 @@ function kube-up {
...
@@ -331,8 +363,10 @@ function kube-up {
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/vsphere/templates/hostname.sh"
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/vsphere/templates/hostname.sh"
echo
"cd /home/kube/cache/kubernetes-install"
echo
"cd /home/kube/cache/kubernetes-install"
echo
"readonly MASTER_NAME='
${
MASTER_NAME
}
'"
echo
"readonly MASTER_NAME='
${
MASTER_NAME
}
'"
echo
"readonly MASTER_IP_RANGE='
${
MASTER_IP_RANGE
}
'"
echo
"readonly INSTANCE_PREFIX='
${
INSTANCE_PREFIX
}
'"
echo
"readonly INSTANCE_PREFIX='
${
INSTANCE_PREFIX
}
'"
echo
"readonly NODE_INSTANCE_PREFIX='
${
INSTANCE_PREFIX
}
-node'"
echo
"readonly NODE_INSTANCE_PREFIX='
${
INSTANCE_PREFIX
}
-node'"
echo
"readonly NODE_IP_RANGES='
${
NODE_IP_RANGES
}
'"
echo
"readonly SERVICE_CLUSTER_IP_RANGE='
${
SERVICE_CLUSTER_IP_RANGE
}
'"
echo
"readonly SERVICE_CLUSTER_IP_RANGE='
${
SERVICE_CLUSTER_IP_RANGE
}
'"
echo
"readonly ENABLE_NODE_LOGGING='
${
ENABLE_NODE_LOGGING
:-
false
}
'"
echo
"readonly ENABLE_NODE_LOGGING='
${
ENABLE_NODE_LOGGING
:-
false
}
'"
echo
"readonly LOGGING_DESTINATION='
${
LOGGING_DESTINATION
:-}
'"
echo
"readonly LOGGING_DESTINATION='
${
LOGGING_DESTINATION
:-}
'"
...
@@ -365,7 +399,7 @@ function kube-up {
...
@@ -365,7 +399,7 @@ function kube-up {
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/vsphere/templates/hostname.sh"
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/vsphere/templates/hostname.sh"
echo
"KUBE_MASTER=
${
KUBE_MASTER
}
"
echo
"KUBE_MASTER=
${
KUBE_MASTER
}
"
echo
"KUBE_MASTER_IP=
${
KUBE_MASTER_IP
}
"
echo
"KUBE_MASTER_IP=
${
KUBE_MASTER_IP
}
"
echo
"NODE_IP_RANGE=
$
{
NODE_IP_RANGES
[
$i
]
}
"
echo
"NODE_IP_RANGE=
$
NODE_IP_RANGES
"
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/vsphere/templates/salt-minion.sh"
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/vsphere/templates/salt-minion.sh"
)
>
"
${
KUBE_TEMP
}
/node-start-
${
i
}
.sh"
)
>
"
${
KUBE_TEMP
}
/node-start-
${
i
}
.sh"
...
@@ -427,8 +461,10 @@ function kube-up {
...
@@ -427,8 +461,10 @@ function kube-up {
done
done
printf
" OK
\n
"
printf
" OK
\n
"
done
done
echo
"Kubernetes cluster created."
setup-pod-routes
echo
"Kubernetes cluster created."
# TODO use token instead of basic auth
# TODO use token instead of basic auth
export
KUBE_CERT
=
"/tmp/
$RANDOM
-kubecfg.crt"
export
KUBE_CERT
=
"/tmp/
$RANDOM
-kubecfg.crt"
export
KUBE_KEY
=
"/tmp/
$RANDOM
-kubecfg.key"
export
KUBE_KEY
=
"/tmp/
$RANDOM
-kubecfg.key"
...
@@ -444,6 +480,7 @@ function kube-up {
...
@@ -444,6 +480,7 @@ function kube-up {
create-kubeconfig
create-kubeconfig
)
)
printf
"
\n
"
echo
echo
echo
"Sanity checking cluster..."
echo
"Sanity checking cluster..."
...
@@ -451,7 +488,6 @@ function kube-up {
...
@@ -451,7 +488,6 @@ function kube-up {
sleep
5
sleep
5
# Basic sanity checking
# Basic sanity checking
local
i
for
((
i
=
0
;
i<
${#
NODE_NAMES
[@]
}
;
i++
))
;
do
for
((
i
=
0
;
i<
${#
NODE_NAMES
[@]
}
;
i++
))
;
do
# Make sure docker is installed
# Make sure docker is installed
kube-ssh
"
${
KUBE_NODE_IP_ADDRESSES
[
$i
]
}
"
which docker
>
/dev/null
||
{
kube-ssh
"
${
KUBE_NODE_IP_ADDRESSES
[
$i
]
}
"
which docker
>
/dev/null
||
{
...
...
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