diff --git a/doc/quickstart.md b/doc/quickstart.md index 16abfedf5..376b4be48 100644 --- a/doc/quickstart.md +++ b/doc/quickstart.md @@ -39,12 +39,19 @@ Firstly, clone this GitHub repository. git clone https://github.com/intel/multus-cni.git && cd multus-cni ``` -We'll apply a YAML file with `kubectl` from this repo. +If you're using Kubernetes 1.16+, we'll apply a YAML file with `kubectl` from this repo. ``` $ cat ./images/multus-daemonset.yml | kubectl apply -f - ``` +Or, for Kubernetes versions < 1.16, use the prior version yaml: + +``` +$ cat ./images/multus-daemonset-pre-1.16.yml | kubectl apply -f - +``` + + ### What the Multus daemonset does * Starts a Multus daemonset, this runs a pod on each node which places a Multus binary on each node in `/opt/cni/bin` @@ -225,4 +232,4 @@ EOF Note that the annotation now reads `k8s.v1.cni.cncf.io/networks: macvlan-conf,macvlan-conf`. Where we have the same configuration used twice, separated by a comma. -If you were to create another custom resource with the name `foo` you could use that such as: `k8s.v1.cni.cncf.io/networks: foo,macvlan-conf`, and use any number of attachments. \ No newline at end of file +If you were to create another custom resource with the name `foo` you could use that such as: `k8s.v1.cni.cncf.io/networks: foo,macvlan-conf`, and use any number of attachments. diff --git a/images/multus-daemonset-pre-1.16.yml b/images/multus-daemonset-pre-1.16.yml new file mode 100644 index 000000000..5551520a8 --- /dev/null +++ b/images/multus-daemonset-pre-1.16.yml @@ -0,0 +1,230 @@ +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: network-attachment-definitions.k8s.cni.cncf.io +spec: + group: k8s.cni.cncf.io + version: v1 + scope: Namespaced + names: + plural: network-attachment-definitions + singular: network-attachment-definition + kind: NetworkAttachmentDefinition + shortNames: + - net-attach-def + validation: + openAPIV3Schema: + properties: + spec: + properties: + config: + type: string +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1beta1 +metadata: + name: multus +rules: + - apiGroups: ["k8s.cni.cncf.io"] + resources: + - '*' + verbs: + - '*' + - apiGroups: + - "" + resources: + - pods + - pods/status + verbs: + - get + - update +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1beta1 +metadata: + name: multus +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: multus +subjects: +- kind: ServiceAccount + name: multus + namespace: kube-system +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: multus + namespace: kube-system +--- +kind: ConfigMap +apiVersion: v1 +metadata: + name: multus-cni-config + namespace: kube-system + labels: + tier: node + app: multus +data: + # NOTE: If you'd prefer to manually apply a configuration file, you may create one here. + # In the case you'd like to customize the Multus installation, you should change the arguments to the Multus pod + # change the "args" line below from + # - "--multus-conf-file=auto" + # to: + # "--multus-conf-file=/tmp/multus-conf/70-multus.conf" + # Additionally -- you should ensure that the name "70-multus.conf" is the alphabetically first name in the + # /etc/cni/net.d/ directory on each node, otherwise, it will not be used by the Kubelet. + cni-conf.json: | + { + "name": "multus-cni-network", + "type": "multus", + "capabilities": { + "portMappings": true + }, + "delegates": [ + { + "cniVersion": "0.3.1", + "name": "default-cni-network", + "plugins": [ + { + "type": "flannel", + "name": "flannel.1", + "delegate": { + "isDefaultGateway": true, + "hairpinMode": true + } + }, + { + "type": "portmap", + "capabilities": { + "portMappings": true + } + } + ] + } + ], + "kubeconfig": "/etc/cni/net.d/multus.d/multus.kubeconfig" + } +--- +apiVersion: extensions/v1beta1 +kind: DaemonSet +metadata: + name: kube-multus-ds-amd64 + namespace: kube-system + labels: + tier: node + app: multus +spec: + updateStrategy: + type: RollingUpdate + template: + metadata: + labels: + tier: node + app: multus + spec: + hostNetwork: true + nodeSelector: + beta.kubernetes.io/arch: amd64 + tolerations: + - operator: Exists + effect: NoSchedule + serviceAccountName: multus + containers: + - name: kube-multus + image: nfvpe/multus:v3.2 + command: ["/entrypoint.sh"] + args: + - "--multus-conf-file=auto" + resources: + requests: + cpu: "100m" + memory: "50Mi" + limits: + cpu: "100m" + memory: "50Mi" + securityContext: + privileged: true + volumeMounts: + - name: cni + mountPath: /host/etc/cni/net.d + - name: cnibin + mountPath: /host/opt/cni/bin + - name: multus-cfg + mountPath: /tmp/multus-conf + volumes: + - name: cni + hostPath: + path: /etc/cni/net.d + - name: cnibin + hostPath: + path: /opt/cni/bin + - name: multus-cfg + configMap: + name: multus-cni-config + items: + - key: cni-conf.json + path: 70-multus.conf +--- +apiVersion: extensions/v1beta1 +kind: DaemonSet +metadata: + name: kube-multus-ds-ppc64le + namespace: kube-system + labels: + tier: node + app: multus +spec: + updateStrategy: + type: RollingUpdate + template: + metadata: + labels: + tier: node + app: multus + spec: + hostNetwork: true + nodeSelector: + beta.kubernetes.io/arch: ppc64le + tolerations: + - operator: Exists + effect: NoSchedule + serviceAccountName: multus + containers: + - name: kube-multus + # ppc64le support requires multus:latest for now. support 3.3 or later. + image: nfvpe/multus:latest-ppc64le + command: ["/entrypoint.sh"] + args: + - "--multus-conf-file=auto" + resources: + requests: + cpu: "100m" + memory: "90Mi" + limits: + cpu: "100m" + memory: "90Mi" + securityContext: + privileged: true + volumeMounts: + - name: cni + mountPath: /host/etc/cni/net.d + - name: cnibin + mountPath: /host/opt/cni/bin + - name: multus-cfg + mountPath: /tmp/multus-conf + volumes: + - name: cni + hostPath: + path: /etc/cni/net.d + - name: cnibin + hostPath: + path: /opt/cni/bin + - name: multus-cfg + configMap: + name: multus-cni-config + items: + - key: cni-conf.json + path: 70-multus.conf diff --git a/images/multus-daemonset.yml b/images/multus-daemonset.yml index 5551520a8..0d0e44183 100644 --- a/images/multus-daemonset.yml +++ b/images/multus-daemonset.yml @@ -108,7 +108,7 @@ data: "kubeconfig": "/etc/cni/net.d/multus.d/multus.kubeconfig" } --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: DaemonSet metadata: name: kube-multus-ds-amd64 @@ -117,6 +117,9 @@ metadata: tier: node app: multus spec: + selector: + matchLabels: + name: multus updateStrategy: type: RollingUpdate template: @@ -124,6 +127,7 @@ spec: labels: tier: node app: multus + name: multus spec: hostNetwork: true nodeSelector: @@ -134,10 +138,11 @@ spec: serviceAccountName: multus containers: - name: kube-multus - image: nfvpe/multus:v3.2 + image: nfvpe/multus:v3.3 command: ["/entrypoint.sh"] args: - "--multus-conf-file=auto" + - "--cni-version=0.3.1" resources: requests: cpu: "100m" @@ -168,7 +173,7 @@ spec: - key: cni-conf.json path: 70-multus.conf --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: DaemonSet metadata: name: kube-multus-ds-ppc64le @@ -177,6 +182,9 @@ metadata: tier: node app: multus spec: + selector: + matchLabels: + name: multus updateStrategy: type: RollingUpdate template: @@ -184,6 +192,7 @@ spec: labels: tier: node app: multus + name: multus spec: hostNetwork: true nodeSelector: @@ -199,6 +208,7 @@ spec: command: ["/entrypoint.sh"] args: - "--multus-conf-file=auto" + - "--cni-version=0.3.1" resources: requests: cpu: "100m"