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
a9524345
Commit
a9524345
authored
Mar 31, 2015
by
Eric Paris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set up flannel in your cluster!
parent
bc6c425a
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
112 additions
and
0 deletions
+112
-0
README.md
contrib/ansible/README.md
+4
-0
cluster.yml
contrib/ansible/cluster.yml
+11
-0
all.yml
contrib/ansible/group_vars/all.yml
+19
-0
main.yml
contrib/ansible/roles/flannel/handlers/main.yml
+18
-0
main.yml
contrib/ansible/roles/flannel/meta/main.yml
+3
-0
client.yml
contrib/ansible/roles/flannel/tasks/client.yml
+17
-0
config.yml
contrib/ansible/roles/flannel/tasks/config.yml
+23
-0
main.yml
contrib/ansible/roles/flannel/tasks/main.yml
+5
-0
flannel-conf.json.j2
contrib/ansible/roles/flannel/templates/flannel-conf.json.j2
+1
-0
flanneld.j2
contrib/ansible/roles/flannel/templates/flanneld.j2
+11
-0
No files found.
contrib/ansible/README.md
View file @
a9524345
...
@@ -47,4 +47,8 @@ Only the kubernetes nodes:
...
@@ -47,4 +47,8 @@ Only the kubernetes nodes:
`INVENTORY=myinventory ./setup.sh`
`INVENTORY=myinventory ./setup.sh`
Only flannel:
$ ./setup.sh --tags=flannel
[

]()
[

]()
contrib/ansible/cluster.yml
View file @
a9524345
...
@@ -8,6 +8,17 @@
...
@@ -8,6 +8,17 @@
tags
:
tags
:
-
etcd
-
etcd
# install flannel
-
hosts
:
-
etcd
-
masters
-
nodes
sudo
:
yes
roles
:
-
flannel
tags
:
-
flannel
# install kube master services
# install kube master services
-
hosts
:
masters
-
hosts
:
masters
sudo
:
yes
sudo
:
yes
...
...
contrib/ansible/group_vars/all.yml
View file @
a9524345
# Only used for the location to store flannel info in etcd, but may be used
# for dns purposes and cluster id purposes in the future.
cluster_name
:
kube.local
# Account name of remote user. Ansible will use this user account to ssh into
# Account name of remote user. Ansible will use this user account to ssh into
# the managed machines. The user must be able to use sudo without asking
# the managed machines. The user must be able to use sudo without asking
# for password unless ansible_sudo_pass is set
# for password unless ansible_sudo_pass is set
...
@@ -15,3 +19,18 @@ ansible_ssh_user: root
...
@@ -15,3 +19,18 @@ ansible_ssh_user: root
# This range must not conflict with anything in your infrastructure. These
# This range must not conflict with anything in your infrastructure. These
# addresses do not need to be routable and must just be an unused block of space.
# addresses do not need to be routable and must just be an unused block of space.
kube_service_addresses
:
10.254.0.0/16
kube_service_addresses
:
10.254.0.0/16
# Flannel internal network (optional). When flannel is used, it will assign IP
# addresses from this range to individual pods.
# This network must be unused in your network infrastructure!
flannel_subnet
:
172.16.0.0
# Flannel internal network total size (optional). This is the prefix of the
# entire flannel overlay network. So the entirety of 172.16.0.0/12 must be
# unused in your environment.
flannel_prefix
:
12
# Flannel internal network (optional). This is the size allocation that flannel
# will give to each node on your network. With these defaults you should have
# room for 4096 nodes with 254 pods per node.
flannel_host_prefix
:
24
contrib/ansible/roles/flannel/handlers/main.yml
0 → 100644
View file @
a9524345
---
-
name
:
restart flannel
service
:
name=flanneld state=restarted
notify
:
-
stop docker
-
delete docker0
-
start docker
when
:
inventory_hostname in groups['nodes']
-
name
:
stop docker
service
:
name=docker state=stopped
-
name
:
delete docker0
command
:
ip link delete docker0
ignore_errors
:
yes
-
name
:
start docker
service
:
name=docker state=started
contrib/ansible/roles/flannel/meta/main.yml
0 → 100644
View file @
a9524345
---
dependencies
:
-
{
role
:
common
}
contrib/ansible/roles/flannel/tasks/client.yml
0 → 100644
View file @
a9524345
---
-
name
:
Install flannel
action
:
"
{{
ansible_pkg_mgr
}}"
args
:
name
:
flannel
state
:
latest
when
:
not is_atomic
-
name
:
Install Flannel config file
template
:
src=flanneld.j2 dest=/etc/sysconfig/flanneld
notify
:
-
restart flannel
-
name
:
Launch Flannel
service
:
name=flanneld state=started enabled=yes
notify
:
-
restart flannel
contrib/ansible/roles/flannel/tasks/config.yml
0 → 100644
View file @
a9524345
---
-
name
:
Set facts about etcdctl command
set_fact
:
peers
:
"
{%
for
hostname
in
groups['etcd']
%}http://{{
hostname
}}:2379{%
if
not
loop.last
%},{%
endif
%}{%
endfor
%}"
conf_file
:
"
/tmp/flannel-conf.json"
conf_loc
:
"
/{{
cluster_name
}}/network/config"
run_once
:
true
delegate_to
:
"
{{
groups['etcd'][0]
}}"
-
name
:
Create flannel config file to go in etcd
template
:
src=flannel-conf.json.j2 dest={{ conf_file }}
run_once
:
true
delegate_to
:
"
{{
groups['etcd'][0]
}}"
-
name
:
Load the flannel config file into etcd
shell
:
"
/usr/bin/etcdctl
--no-sync
--peers={{
peers
}}
set
{{
conf_loc
}}
<
{{
conf_file
}}"
run_once
:
true
delegate_to
:
"
{{
groups['etcd'][0]
}}"
-
name
:
Clean up the flannel config file
file
:
path=/tmp/flannel-config.json state=absent
run_once
:
true
delegate_to
:
"
{{
groups['etcd'][0]
}}"
contrib/ansible/roles/flannel/tasks/main.yml
0 → 100644
View file @
a9524345
---
-
include
:
config.yml
-
include
:
client.yml
when
:
inventory_hostname in groups['masters'] + groups['nodes']
contrib/ansible/roles/flannel/templates/flannel-conf.json.j2
0 → 100644
View file @
a9524345
{ "Network": "{{ flannel_subnet }}/{{ flannel_prefix }}", "SubnetLen": {{ flannel_host_prefix }}, "Backend": { "Type": "vxlan" } }
contrib/ansible/roles/flannel/templates/flanneld.j2
0 → 100644
View file @
a9524345
# Flanneld configuration options
# etcd url location. Point this to the server where etcd runs
FLANNEL_ETCD="http://{{ groups['etcd'][0] }}:2379"
# etcd config key. This is the configuration key that flannel queries
# For address range assignment
FLANNEL_ETCD_KEY="/{{ cluster_name }}/network"
# Any additional options that you want to pass
#FLANNEL_OPTIONS=""
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