mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-01 09:38:12 -03:30
Adds support for Multus (multiple interfaces) CNI plugin (#3166)
* Adds support for Multus (multiple interfaces) CNI plugin Multus is a latin word for "Multi". As the name suggests, it acts as a Multi plugin in Kubernetes and provides multiple network interface support in a pod. Multus uses the concept of invoking delegates by grouping multiple plugins into delegates and invoking them in the sequential order of the CNI configuration file provided in json format. * Change CNI version (0.1.0->0.3.1) of Contiv to be compatible with Multus
This commit is contained in:
committed by
k8s-ci-robot
parent
3c5f20190f
commit
bc9e14a762
12
tests/files/gce_centos7-multus-calico.yml
Normal file
12
tests/files/gce_centos7-multus-calico.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
# Instance settings
|
||||
cloud_image_family: centos-7
|
||||
cloud_region: us-central1-c
|
||||
cloud_machine_type: "n1-standard-1"
|
||||
mode: default
|
||||
|
||||
# Deployment settings
|
||||
kube_network_plugin_multus: true
|
||||
kube_network_plugin: calico
|
||||
deploy_netchecker: true
|
||||
kubedns_min_replicas: 1
|
||||
cloud_provider: gce
|
||||
@@ -80,3 +80,68 @@
|
||||
run_once: true
|
||||
when:
|
||||
- agents.content == '{}'
|
||||
|
||||
- name: Create macvlan network conf
|
||||
# We cannot use only shell: below because Ansible will render the text
|
||||
# with leading spaces, which means the shell will never find the string
|
||||
# EOF at the beginning of a line. We can avoid Ansible's unhelpful
|
||||
# heuristics by using the cmd parameter like this:
|
||||
shell:
|
||||
cmd: |
|
||||
cat <<EOF | {{ bin_dir }}/kubectl create -f -
|
||||
apiVersion: "k8s.cni.cncf.io/v1"
|
||||
kind: NetworkAttachmentDefinition
|
||||
metadata:
|
||||
name: macvlan-conf
|
||||
spec:
|
||||
config: '{
|
||||
"cniVersion": "0.3.0",
|
||||
"type": "macvlan",
|
||||
"master": "eth0",
|
||||
"mode": "bridge",
|
||||
"ipam": {
|
||||
"type": "host-local",
|
||||
"subnet": "192.168.1.0/24",
|
||||
"rangeStart": "192.168.1.200",
|
||||
"rangeEnd": "192.168.1.216",
|
||||
"routes": [
|
||||
{ "dst": "0.0.0.0/0" }
|
||||
],
|
||||
"gateway": "192.168.1.1"
|
||||
}
|
||||
}'
|
||||
EOF
|
||||
when:
|
||||
- kube_network_plugin_multus|default(false)
|
||||
|
||||
- name: Annotate pod with macvlan network
|
||||
# We cannot use only shell: below because Ansible will render the text
|
||||
# with leading spaces, which means the shell will never find the string
|
||||
# EOF at the beginning of a line. We can avoid Ansible's unhelpful
|
||||
# heuristics by using the cmd parameter like this:
|
||||
shell:
|
||||
cmd: |
|
||||
cat <<EOF | {{ bin_dir }}/kubectl create -f -
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: samplepod
|
||||
annotations:
|
||||
k8s.v1.cni.cncf.io/networks: macvlan-conf
|
||||
spec:
|
||||
containers:
|
||||
- name: samplepod
|
||||
command: ["/bin/bash", "-c", "sleep 2000000000000"]
|
||||
image: dougbtv/centos-network
|
||||
EOF
|
||||
when:
|
||||
- kube_network_plugin_multus|default(false)
|
||||
|
||||
- name: Check secondary macvlan interface
|
||||
shell: "{{ bin_dir }}/kubectl exec samplepod -- ip addr show dev net1"
|
||||
register: output
|
||||
until: output.rc == 0
|
||||
retries: 90
|
||||
changed_when: false
|
||||
when:
|
||||
- kube_network_plugin_multus|default(false)
|
||||
|
||||
Reference in New Issue
Block a user