multus-daemonset-thick.yml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. # Note:
  2. # This deployment file is designed for 'quickstart' of multus, easy installation to test it,
  3. # hence this deployment yaml does not care about following things intentionally.
  4. # - various configuration options
  5. # - minor deployment scenario
  6. # - upgrade/update/uninstall scenario
  7. # Multus team understand users deployment scenarios are diverse, hence we do not cover
  8. # comprehensive deployment scenario. We expect that it is covered by each platform deployment.
  9. ---
  10. apiVersion: apiextensions.k8s.io/v1
  11. kind: CustomResourceDefinition
  12. metadata:
  13. name: network-attachment-definitions.k8s.cni.cncf.io
  14. spec:
  15. group: k8s.cni.cncf.io
  16. scope: Namespaced
  17. names:
  18. plural: network-attachment-definitions
  19. singular: network-attachment-definition
  20. kind: NetworkAttachmentDefinition
  21. shortNames:
  22. - net-attach-def
  23. versions:
  24. - name: v1
  25. served: true
  26. storage: true
  27. schema:
  28. openAPIV3Schema:
  29. description: 'NetworkAttachmentDefinition is a CRD schema specified by the Network Plumbing
  30. Working Group to express the intent for attaching pods to one or more logical or physical
  31. networks. More information available at: https://github.com/k8snetworkplumbingwg/multi-net-spec'
  32. type: object
  33. properties:
  34. apiVersion:
  35. description: 'APIVersion defines the versioned schema of this represen
  36. tation of an object. Servers should convert recognized schemas to the
  37. latest internal value, and may reject unrecognized values. More info:
  38. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
  39. type: string
  40. kind:
  41. description: 'Kind is a string value representing the REST resource this
  42. object represents. Servers may infer this from the endpoint the client
  43. submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
  44. type: string
  45. metadata:
  46. type: object
  47. spec:
  48. description: 'NetworkAttachmentDefinition spec defines the desired state of a network attachment'
  49. type: object
  50. properties:
  51. config:
  52. description: 'NetworkAttachmentDefinition config is a JSON-formatted CNI configuration'
  53. type: string
  54. ---
  55. kind: ClusterRole
  56. apiVersion: rbac.authorization.k8s.io/v1
  57. metadata:
  58. name: multus
  59. rules:
  60. - apiGroups: ["k8s.cni.cncf.io"]
  61. resources:
  62. - '*'
  63. verbs:
  64. - '*'
  65. - apiGroups:
  66. - ""
  67. resources:
  68. - pods
  69. - pods/status
  70. verbs:
  71. - get
  72. - list
  73. - update
  74. - watch
  75. - apiGroups:
  76. - ""
  77. - events.k8s.io
  78. resources:
  79. - events
  80. verbs:
  81. - create
  82. - patch
  83. - update
  84. ---
  85. kind: ClusterRoleBinding
  86. apiVersion: rbac.authorization.k8s.io/v1
  87. metadata:
  88. name: multus
  89. roleRef:
  90. apiGroup: rbac.authorization.k8s.io
  91. kind: ClusterRole
  92. name: multus
  93. subjects:
  94. - kind: ServiceAccount
  95. name: multus
  96. namespace: kube-system
  97. ---
  98. apiVersion: v1
  99. kind: ServiceAccount
  100. metadata:
  101. name: multus
  102. namespace: kube-system
  103. ---
  104. kind: ConfigMap
  105. apiVersion: v1
  106. metadata:
  107. name: multus-daemon-config
  108. namespace: kube-system
  109. labels:
  110. tier: node
  111. app: multus
  112. data:
  113. daemon-config.json: |
  114. {
  115. "chrootDir": "/hostroot",
  116. "cniVersion": "0.3.1",
  117. "logLevel": "verbose",
  118. "logToStderr": true,
  119. "cniConfigDir": "/host/etc/cni/net.d",
  120. "multusAutoconfigDir": "/host/etc/cni/net.d",
  121. "multusConfigFile": "auto",
  122. "socketDir": "/host/run/multus/"
  123. }
  124. ---
  125. apiVersion: apps/v1
  126. kind: DaemonSet
  127. metadata:
  128. name: kube-multus-ds
  129. namespace: kube-system
  130. labels:
  131. tier: node
  132. app: multus
  133. name: multus
  134. spec:
  135. selector:
  136. matchLabels:
  137. name: multus
  138. updateStrategy:
  139. type: RollingUpdate
  140. template:
  141. metadata:
  142. labels:
  143. tier: node
  144. app: multus
  145. name: multus
  146. spec:
  147. hostNetwork: true
  148. hostPID: true
  149. tolerations:
  150. - operator: Exists
  151. effect: NoSchedule
  152. - operator: Exists
  153. effect: NoExecute
  154. serviceAccountName: multus
  155. containers:
  156. - name: kube-multus
  157. image: ghcr.io/k8snetworkplumbingwg/multus-cni:snapshot-thick
  158. command: [ "/usr/src/multus-cni/bin/multus-daemon" ]
  159. resources:
  160. requests:
  161. cpu: "100m"
  162. memory: "50Mi"
  163. limits:
  164. cpu: "100m"
  165. memory: "50Mi"
  166. securityContext:
  167. privileged: true
  168. terminationMessagePolicy: FallbackToLogsOnError
  169. volumeMounts:
  170. - name: cni
  171. mountPath: /host/etc/cni/net.d
  172. # multus-daemon expects that cnibin path must be identical between pod and container host.
  173. # e.g. if the cni bin is in '/opt/cni/bin' on the container host side, then it should be mount to '/opt/cni/bin' in multus-daemon,
  174. # not to any other directory, like '/opt/bin' or '/usr/bin'.
  175. - name: cnibin
  176. mountPath: /opt/cni/bin
  177. - name: host-run
  178. mountPath: /host/run
  179. - name: host-var-lib-cni-multus
  180. mountPath: /var/lib/cni/multus
  181. - name: host-var-lib-kubelet
  182. mountPath: /var/lib/kubelet
  183. mountPropagation: HostToContainer
  184. - name: host-run-k8s-cni-cncf-io
  185. mountPath: /run/k8s.cni.cncf.io
  186. - name: host-run-netns
  187. mountPath: /run/netns
  188. mountPropagation: HostToContainer
  189. - name: multus-daemon-config
  190. mountPath: /etc/cni/net.d/multus.d
  191. readOnly: true
  192. - name: hostroot
  193. mountPath: /hostroot
  194. mountPropagation: HostToContainer
  195. env:
  196. - name: MULTUS_NODE_NAME
  197. valueFrom:
  198. fieldRef:
  199. fieldPath: spec.nodeName
  200. initContainers:
  201. - name: install-multus-binary
  202. image: ghcr.io/k8snetworkplumbingwg/multus-cni:snapshot-thick
  203. command:
  204. - "cp"
  205. - "/usr/src/multus-cni/bin/multus-shim"
  206. - "/host/opt/cni/bin/multus-shim"
  207. resources:
  208. requests:
  209. cpu: "10m"
  210. memory: "15Mi"
  211. securityContext:
  212. privileged: true
  213. terminationMessagePolicy: FallbackToLogsOnError
  214. volumeMounts:
  215. - name: cnibin
  216. mountPath: /host/opt/cni/bin
  217. mountPropagation: Bidirectional
  218. terminationGracePeriodSeconds: 10
  219. volumes:
  220. - name: cni
  221. hostPath:
  222. path: /etc/cni/net.d
  223. - name: cnibin
  224. hostPath:
  225. path: /opt/cni/bin
  226. - name: hostroot
  227. hostPath:
  228. path: /
  229. - name: multus-daemon-config
  230. configMap:
  231. name: multus-daemon-config
  232. items:
  233. - key: daemon-config.json
  234. path: daemon-config.json
  235. - name: host-run
  236. hostPath:
  237. path: /run
  238. - name: host-var-lib-cni-multus
  239. hostPath:
  240. path: /var/lib/cni/multus
  241. - name: host-var-lib-kubelet
  242. hostPath:
  243. path: /var/lib/kubelet
  244. - name: host-run-k8s-cni-cncf-io
  245. hostPath:
  246. path: /run/k8s.cni.cncf.io
  247. - name: host-run-netns
  248. hostPath:
  249. path: /run/netns/