From 747d31bb309b55b870cd4c92eebb8dfef7175714 Mon Sep 17 00:00:00 2001 From: Aneesh Puttur Date: Mon, 28 Jan 2019 14:19:31 -0500 Subject: [PATCH 1/2] Fix Bin directory is different when using CRI-O Added new configuration file for crio runtime multus-crio-daemonset.yml Added instructions to readme for crio users. Fixes #224 Signed-off-by : Aneesh Puttur --- README.md | 7 ++ images/README.md | 4 + images/multus-crio-daemonset.yml | 148 +++++++++++++++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 images/multus-crio-daemonset.yml diff --git a/README.md b/README.md index 8ddc15655..c9a760949 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,13 @@ We apply these files as such: $ cat ./images/{multus-daemonset.yml,flannel-daemonset.yml} | kubectl apply -f - ``` +Note: For crio runtime use multus-crio-daemonset.yml (crio uses /usr/libexec/cni as default path for plugin directory). Before deploying daemonsets,delete all default network plugin configuration files under /etc/cni/net.d +If the runtime is cri-o, then apply these files. + +``` +$ cat ./images/{multus-crio-daemonset.yml,flannel-daemonset.yml} | kubectl apply -f - +``` + This will configure your systems to be ready to use Multus CNI, but, to get started with adding additional interfaces to your pods, refer to our complete [quick-start guide](doc/quickstart.md) ## Additional installation Options diff --git a/images/README.md b/images/README.md index 706268365..1288ca882 100644 --- a/images/README.md +++ b/images/README.md @@ -17,6 +17,10 @@ You may wish to deploy Multus as a daemonset, you can do so by starting with the ``` $ kubectl create -f ./images/multus-daemonset.yml ``` +Note: For crio runtime use multus-crio-daemonset.yml (crio uses /usr/libexec/cni as default path for plugin directory). Before deploying daemonsets,delete all default network plugin configuration files under /etc/cni/net.d +``` +$ kubectl create -f ./images/multus-crio-daemonset.yml +``` Note: The likely best practice here is to build your own image given the Dockerfile, and then push it to your preferred registry, and change the `image` fields in the Daemonset YAML to reference that image. diff --git a/images/multus-crio-daemonset.yml b/images/multus-crio-daemonset.yml new file mode 100644 index 000000000..621453d62 --- /dev/null +++ b/images/multus-crio-daemonset.yml @@ -0,0 +1,148 @@ +--- +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 +--- +# ------------------------------------------------------ +# Currently unused! +# If you wish to customize, mount this in the +# daemonset @ /usr/src/multus-cni/images/70-multus.conf +# ------------------------------------------------------ +kind: ConfigMap +apiVersion: v1 +metadata: + name: multus-cni-config + namespace: kube-system + labels: + tier: node + app: multus +data: + cni-conf.json: | + { + "name": "multus-cni-network", + "type": "multus", + "delegates": [ + { + "type": "flannel", + "name": "flannel.1", + "delegate": { + "isDefaultGateway": true + } + } + ], + "kubeconfig": "/etc/cni/net.d/multus.d/multus.kubeconfig" + } +# -------------- for openshift. +# "delegates": [{ +# "type": "openshift-sdn", +# "name:" "openshift.1", +# "masterplugin": true +# }], +--- +apiVersion: extensions/v1beta1 +kind: DaemonSet +metadata: + name: kube-multus-ds-amd64 + namespace: kube-system + labels: + tier: node + app: multus +spec: + 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:latest + command: ["/entrypoint.sh"] + args: ["--cni-bin-dir=/host/usr/libexec/cni"] + 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/usr/libexec/cni + volumes: + - name: cni + hostPath: + path: /etc/cni/net.d + - name: cnibin + hostPath: + path: /usr/libexec/cni + - name: multus-cfg + configMap: + name: multus-cni-config From f229cbe47fdcc7dd646904714d7f20581da24e4d Mon Sep 17 00:00:00 2001 From: Aneesh Puttur Date: Wed, 30 Jan 2019 09:22:46 -0500 Subject: [PATCH 2/2] moved crio details out of the README.md and into the ./docs/quickstart.md --- README.md | 7 ------- doc/quickstart.md | 6 ++++++ images/README.md | 4 ---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c9a760949..8ddc15655 100644 --- a/README.md +++ b/README.md @@ -32,13 +32,6 @@ We apply these files as such: $ cat ./images/{multus-daemonset.yml,flannel-daemonset.yml} | kubectl apply -f - ``` -Note: For crio runtime use multus-crio-daemonset.yml (crio uses /usr/libexec/cni as default path for plugin directory). Before deploying daemonsets,delete all default network plugin configuration files under /etc/cni/net.d -If the runtime is cri-o, then apply these files. - -``` -$ cat ./images/{multus-crio-daemonset.yml,flannel-daemonset.yml} | kubectl apply -f - -``` - This will configure your systems to be ready to use Multus CNI, but, to get started with adding additional interfaces to your pods, refer to our complete [quick-start guide](doc/quickstart.md) ## Additional installation Options diff --git a/doc/quickstart.md b/doc/quickstart.md index 4c8734d13..6c75b5a37 100644 --- a/doc/quickstart.md +++ b/doc/quickstart.md @@ -27,6 +27,12 @@ We'll apply files to `kubectl` from this repo. The files we're applying here spe $ cat ./images/{multus-daemonset.yml,flannel-daemonset.yml} | kubectl apply -f - ``` +Note: For crio runtime use multus-crio-daemonset.yml (crio uses /usr/libexec/cni as default path for plugin directory). Before deploying daemonsets,delete all default network plugin configuration files under /etc/cni/net.d +If the runtime is cri-o, then apply these files. + +``` +$ cat ./images/{multus-crio-daemonset.yml,flannel-daemonset.yml} | kubectl apply -f - +``` ### Validating your installation Generally, the first step in validating your installation is to look at the `STATUS` field of your nodes, you can check it out by looking at: diff --git a/images/README.md b/images/README.md index 1288ca882..706268365 100644 --- a/images/README.md +++ b/images/README.md @@ -17,10 +17,6 @@ You may wish to deploy Multus as a daemonset, you can do so by starting with the ``` $ kubectl create -f ./images/multus-daemonset.yml ``` -Note: For crio runtime use multus-crio-daemonset.yml (crio uses /usr/libexec/cni as default path for plugin directory). Before deploying daemonsets,delete all default network plugin configuration files under /etc/cni/net.d -``` -$ kubectl create -f ./images/multus-crio-daemonset.yml -``` Note: The likely best practice here is to build your own image given the Dockerfile, and then push it to your preferred registry, and change the `image` fields in the Daemonset YAML to reference that image.