Added generic CNI network plugin (#4322)
* Added generic CNI network plugin * Added CNI network plugin documentation * added necessary fixpull/4439/head
parent
586ad89d50
commit
a30ad1e5a5
|
@ -0,0 +1,10 @@
|
|||
CNI
|
||||
==============
|
||||
|
||||
This network plugin only unpacks CNI plugins version `cni_version` into `/opt/cni/bin` and instructs kubelet to use cni, that is adds following cli params:
|
||||
|
||||
`KUBELET_NETWORK_PLUGIN="--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"`
|
||||
|
||||
It's intended usage is for custom CNI configuration, e.g. manual routing tables + bridge + loopback CNI plugin outside kubespray scope. Furthermore, it's used for non-kubespray supported CNI plugins which you can install afterward.
|
||||
|
||||
You are required to fill `/etc/cni/net.d` with valid CNI configuration after using kubespray.
|
|
@ -70,7 +70,7 @@ kube_users:
|
|||
# kube_oidc_groups_prefix: oidc:
|
||||
|
||||
|
||||
# Choose network plugin (cilium, calico, contiv, weave or flannel)
|
||||
# Choose network plugin (cilium, calico, contiv, weave or flannel. Use cni for generic cni plugin)
|
||||
# Can also be set to 'cloud', which lets the cloud provider setup appropriate routing
|
||||
kube_network_plugin: calico
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
- name: CNI | make sure /opt/cni/bin exists
|
||||
file:
|
||||
path: /opt/cni/bin
|
||||
state: directory
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
- name: CNI | Copy cni plugins
|
||||
unarchive:
|
||||
src: "{{ local_release_dir }}/cni-plugins-{{ image_arch }}-{{ cni_version }}.tgz"
|
||||
dest: "/opt/cni/bin"
|
||||
mode: 0755
|
||||
remote_src: yes
|
|
@ -25,6 +25,11 @@ dependencies:
|
|||
tags:
|
||||
- contiv
|
||||
|
||||
- role: kubernetes-apps/network_plugin/cni
|
||||
when: kube_network_plugin == 'cni'
|
||||
tags:
|
||||
- cni
|
||||
|
||||
- role: kubernetes-apps/network_plugin/weave
|
||||
when: kube_network_plugin == 'weave'
|
||||
tags:
|
||||
|
|
|
@ -117,7 +117,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
|
|||
{% endif %}
|
||||
|
||||
KUBELET_ARGS="{{ kubelet_args_base }} {{ kubelet_args_dns }} {{ kube_reserved }} {% if node_taints|default([]) %}--register-with-taints={{ node_taints | join(',') }} {% endif %}--node-labels={{ all_node_labels | join(',') }} {% if kube_feature_gates %} --feature-gates={{ kube_feature_gates|join(',') }} {% endif %} {% if kubelet_custom_flags is string %} {{kubelet_custom_flags}} {% else %}{% for flag in kubelet_custom_flags %} {{flag}} {% endfor %}{% endif %}{% if inventory_hostname in groups['kube-node'] %}{% if kubelet_node_custom_flags is string %} {{kubelet_node_custom_flags}} {% else %}{% for flag in kubelet_node_custom_flags %} {{flag}} {% endfor %}{% endif %}{% endif %}"
|
||||
{% if kube_network_plugin is defined and kube_network_plugin in ["calico", "canal", "flannel", "weave", "contiv", "cilium", "kube-router"] %}
|
||||
{% if kube_network_plugin is defined and kube_network_plugin in ["calico", "canal", "cni", "flannel", "weave", "contiv", "cilium", "kube-router"] %}
|
||||
KUBELET_NETWORK_PLUGIN="--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
|
||||
{% elif kube_network_plugin is defined and kube_network_plugin == "cloud" %}
|
||||
KUBELET_NETWORK_PLUGIN="--hairpin-mode=promiscuous-bridge --network-plugin=kubenet"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
- name: Stop if unknown network plugin
|
||||
assert:
|
||||
that: kube_network_plugin in ['calico', 'canal', 'flannel', 'weave', 'cloud', 'cilium', 'contiv', 'kube-router']
|
||||
that: kube_network_plugin in ['calico', 'canal', 'flannel', 'weave', 'cloud', 'cilium', 'cni', 'contiv', 'kube-router']
|
||||
when: kube_network_plugin is defined
|
||||
ignore_errors: "{{ ignore_assert_errors }}"
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
- name: CNI | make sure /opt/cni/bin exists
|
||||
file:
|
||||
path: /opt/cni/bin
|
||||
state: directory
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
- name: CNI | Copy cni plugins
|
||||
unarchive:
|
||||
src: "{{ local_release_dir }}/cni-plugins-{{ image_arch }}-{{ cni_version }}.tgz"
|
||||
dest: "/opt/cni/bin"
|
||||
mode: 0755
|
||||
remote_src: yes
|
Loading…
Reference in New Issue