mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-16 18:50:08 -03:30
Calico is not a network overlay
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
---
|
||||
- name: Write script for calico/docker bridge configuration
|
||||
template: src=create_cbr.j2 dest=/etc/network/if-up.d/create_cbr mode=u+x
|
||||
when: overlay_network_plugin is defined and overlay_network_plugin == "calico"
|
||||
when: kube_network_plugin is defined and kube_network_plugin == "calico"
|
||||
|
||||
- name: Configure calico/docker bridge
|
||||
shell: /etc/network/if-up.d/create_cbr
|
||||
when: overlay_network_plugin is defined and overlay_network_plugin == "calico"
|
||||
when: kube_network_plugin is defined and kube_network_plugin == "calico"
|
||||
|
||||
- name: Configure docker to use cbr0 bridge
|
||||
lineinfile:
|
||||
@@ -14,7 +14,7 @@
|
||||
line='DOCKER_OPTS="--bridge=cbr0 --iptables=false --ip-masq=false"'
|
||||
notify:
|
||||
- restart docker
|
||||
when: overlay_network_plugin is defined and overlay_network_plugin == "calico"
|
||||
when: kube_network_plugin is defined and kube_network_plugin == "calico"
|
||||
|
||||
- name: enable docker
|
||||
service:
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
with_items:
|
||||
- aufs-tools
|
||||
- cgroupfs-mount
|
||||
- docker-engine=1.8.2-0~{{ ansible_distribution_release }}
|
||||
- docker-engine=1.8.3-0~{{ ansible_distribution_release }}
|
||||
|
||||
- name: Copy default docker configuration
|
||||
template: src=default-docker.j2 dest=/etc/default/docker
|
||||
|
||||
@@ -9,6 +9,6 @@ fi
|
||||
|
||||
# Configure calico bridge ip
|
||||
br_ips=$(ip addr list cbr0 |grep "inet " |cut -d' ' -f6)
|
||||
if ! [[ "${br_ips}" =~ "{{ br_addr }}/{{ overlay_network_host_prefix }}" ]];then
|
||||
ip a add {{ br_addr }}/{{ overlay_network_host_prefix }} dev cbr0
|
||||
if ! [[ "${br_ips}" =~ "{{ br_addr }}/{{ kube_network_node_prefix }}" ]];then
|
||||
ip a add {{ br_addr }}/{{ kube_network_node_prefix }} dev cbr0
|
||||
fi
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#DOCKER="/usr/local/bin/docker"
|
||||
|
||||
# Use DOCKER_OPTS to modify the daemon startup options.
|
||||
{% if overlay_network_plugin is defined and overlay_network_plugin == "calico" %}
|
||||
{% if kube_network_plugin is defined and kube_network_plugin == "calico" %}
|
||||
DOCKER_OPTS="--bridge=cbr0 --iptables=false --ip-masq=false"
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Unit]
|
||||
Description=Kubernetes Kube-Proxy Server
|
||||
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
|
||||
{% if overlay_network_plugin|default('') %}
|
||||
{% if kube_network_plugin is defined and kube_network_plugin == "calico" %}
|
||||
After=docker.service calico-node.service
|
||||
{% else %}
|
||||
After=docker.service
|
||||
|
||||
@@ -16,6 +16,6 @@ Environment="KUBELET_ARGS=--cluster_dns={{ dns_server }} --cluster_domain={{ dns
|
||||
{% else %}
|
||||
Environment="KUBELET_ARGS=--kubeconfig={{ kube_config_dir}}/kubelet.kubeconfig --config={{ kube_manifest_dir }}"
|
||||
{% endif %}
|
||||
{% if overlay_network_plugin|default('') %}
|
||||
Environment="KUBELET_NETWORK_PLUGIN=--network_plugin={{ overlay_network_plugin }}"
|
||||
{% if kube_network_plugin is defined and kube_network_plugin == "calico" %}
|
||||
Environment="KUBELET_NETWORK_PLUGIN=--network_plugin={{ kube_network_plugin }}"
|
||||
{% endif %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Unit]
|
||||
Description=Kubernetes Kube-Proxy Server
|
||||
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
|
||||
{% if overlay_network_plugin|default('') %}
|
||||
{% if kube_network_plugin is defined and kube_network_plugin == "calico" %}
|
||||
After=docker.service calico-node.service
|
||||
{% else %}
|
||||
After=docker.service
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Unit]
|
||||
Description=Kubernetes Kubelet Server
|
||||
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
|
||||
{% if overlay_network_plugin|default('') %}
|
||||
{% if kube_network_plugin is defined and kube_network_plugin == "calico" %}
|
||||
After=docker.service calico-node.service
|
||||
{% else %}
|
||||
After=docker.service
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
run_once: true
|
||||
|
||||
- name: Calico | Configure calico-node desired pool
|
||||
shell: calicoctl pool add {{ overlay_network_subnet }}
|
||||
shell: calicoctl pool add {{ kube_pods_subnet }}
|
||||
environment:
|
||||
ETCD_AUTHORITY: "{{ groups['kube-master'][0] }}:4001"
|
||||
run_once: true
|
||||
13
roles/network_plugin/tasks/main.yml
Normal file
13
roles/network_plugin/tasks/main.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: "Test if network plugin is defined"
|
||||
fail: msg="ERROR, One network_plugin variable must be defined (Flannel or Calico)"
|
||||
when: ( kube_network_plugin is defined and kube_network_plugin == "calico" and kube_network_plugin == "flannel" ) or
|
||||
kube_network_plugin is not defined
|
||||
|
||||
- include: flannel.yml
|
||||
when: kube_network_plugin == "flannel"
|
||||
- include: calico.yml
|
||||
when: kube_network_plugin == "calico"
|
||||
|
||||
- meta: flush_handlers
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "Network": "{{ kube_service_addresses }}", "SubnetLen": {{ kube_network_node_prefix }}, "Backend": { "Type": "vxlan" } }
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
- name: "Test if overlay network is defined"
|
||||
fail: msg="ERROR, One overlay_network variable must be defined (Flannel or Calico)"
|
||||
when: ( overlay_network_plugin is defined and overlay_network_plugin == "calico" and overlay_network_plugin == "flannel" ) or
|
||||
overlay_network_plugin is not defined
|
||||
|
||||
- include: flannel.yml
|
||||
when: overlay_network_plugin == "flannel"
|
||||
- include: calico.yml
|
||||
when: overlay_network_plugin == "calico"
|
||||
|
||||
- meta: flush_handlers
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{ "Network": "{{ kube_service_addresses }}", "SubnetLen": {{ overlay_network_host_prefix }}, "Backend": { "Type": "vxlan" } }
|
||||
Reference in New Issue
Block a user