Kubespray: Vagrant + flannel configuration improvement

Created on 26 Dec 2017  路  2Comments  路  Source: kubernetes-sigs/kubespray

Environment:

  • Vagrant 2.0.1
  • OS: CentOS Linux release 7.4.1708 (Core)
  • ansible 2.4.2.0 (installed by pip)
  • Kubespray version (commit): ad6fece
  • Network plugin used: flannel

Copy of your inventory file:

no change from repository

Command used to invoke ansible:

vagrant up

After vagrat up, pods cannot communicate each other, over flannel.

When use Vagrant, flanneld need to specify interface to eth1(flanneld option --iface=eth1 is required).

As workaround, I changed yaml and solve problem.

diff --git a/roles/network_plugin/flannel/defaults/main.yml b/roles/network_plugin/flannel/defaults/main.yml
index 08f4ac1..24ee2cd 100644
--- a/roles/network_plugin/flannel/defaults/main.yml
+++ b/roles/network_plugin/flannel/defaults/main.yml
@@ -7,6 +7,7 @@
 ## interface that should be used for flannel operations
 ## This is actually an inventory node-level item
 # flannel_interface:
+flannel_interface: eth1

 # You can choose what type of flannel backend to use
 # please refer to flannel's docs : https://github.com/coreos/flannel/blob/master/README.md
@@ -19,4 +20,4 @@ flannel_memory_requests: 64M
 flannel_cpu_requests: 150m

 # Legacy directory, will be removed if found.
-flannel_cert_dir: /etc/flannel/certs
\ No newline at end of file
+flannel_cert_dir: /etc/flannel/certs

I hope to be that when use vagrant, automatically set flannel_interface to eth1.

lifecyclstale

Most helpful comment

for vagrant: in hosts.ini add option "flannel_interface="

example: k8s-01 ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222 ansible_ssh_user='vagrant' ip=172.17.8.101 flannel_interface=eth1 flannel_backend_type=host-gw local_release_dir=/vagrant/temp download_run_once=False kube_network_plugin=flannel bootstrap_os=ubuntu

All 2 comments

for vagrant: in hosts.ini add option "flannel_interface="

example: k8s-01 ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222 ansible_ssh_user='vagrant' ip=172.17.8.101 flannel_interface=eth1 flannel_backend_type=host-gw local_release_dir=/vagrant/temp download_run_once=False kube_network_plugin=flannel bootstrap_os=ubuntu

This configuration should be default in Vagrantfile. The current behavior makes it unusable without adjustments.

Was this page helpful?
0 / 5 - 0 ratings