You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

354 lines
8.4 KiB

  1. ---
  2. apiVersion: v1
  3. kind: ConfigMap
  4. metadata:
  5. name: ovn-config
  6. namespace: kube-system
  7. ---
  8. apiVersion: v1
  9. kind: ServiceAccount
  10. metadata:
  11. name: ovn
  12. namespace: kube-system
  13. ---
  14. apiVersion: rbac.authorization.k8s.io/v1
  15. kind: ClusterRole
  16. metadata:
  17. annotations:
  18. rbac.authorization.k8s.io/system-only: "true"
  19. name: system:ovn
  20. rules:
  21. - apiGroups:
  22. - "kubeovn.io"
  23. resources:
  24. - subnets
  25. - subnets/status
  26. - ips
  27. - vlans
  28. verbs:
  29. - "*"
  30. - apiGroups:
  31. - ""
  32. resources:
  33. - pods
  34. - namespaces
  35. - nodes
  36. - configmaps
  37. verbs:
  38. - create
  39. - get
  40. - list
  41. - watch
  42. - patch
  43. - update
  44. - apiGroups:
  45. - ""
  46. - networking.k8s.io
  47. - apps
  48. - extensions
  49. resources:
  50. - networkpolicies
  51. - services
  52. - endpoints
  53. - statefulsets
  54. - daemonsets
  55. - deployments
  56. verbs:
  57. - get
  58. - list
  59. - watch
  60. - apiGroups:
  61. - ""
  62. resources:
  63. - events
  64. verbs:
  65. - create
  66. - patch
  67. - update
  68. ---
  69. apiVersion: rbac.authorization.k8s.io/v1
  70. kind: ClusterRoleBinding
  71. metadata:
  72. name: ovn
  73. roleRef:
  74. name: system:ovn
  75. kind: ClusterRole
  76. apiGroup: rbac.authorization.k8s.io
  77. subjects:
  78. - kind: ServiceAccount
  79. name: ovn
  80. namespace: kube-system
  81. ---
  82. kind: Service
  83. apiVersion: v1
  84. metadata:
  85. name: ovn-nb
  86. namespace: kube-system
  87. spec:
  88. ports:
  89. - name: ovn-nb
  90. protocol: TCP
  91. port: 6641
  92. targetPort: 6641
  93. type: ClusterIP
  94. selector:
  95. app: ovn-central
  96. ovn-nb-leader: "true"
  97. sessionAffinity: None
  98. ---
  99. kind: Service
  100. apiVersion: v1
  101. metadata:
  102. name: ovn-sb
  103. namespace: kube-system
  104. spec:
  105. ports:
  106. - name: ovn-sb
  107. protocol: TCP
  108. port: 6642
  109. targetPort: 6642
  110. type: ClusterIP
  111. selector:
  112. app: ovn-central
  113. ovn-sb-leader: "true"
  114. sessionAffinity: None
  115. ---
  116. kind: Deployment
  117. apiVersion: apps/v1
  118. metadata:
  119. name: ovn-central
  120. namespace: kube-system
  121. annotations:
  122. kubernetes.io/description: |
  123. OVN components: northd, nb and sb.
  124. spec:
  125. replicas: 1
  126. strategy:
  127. rollingUpdate:
  128. maxSurge: 0%
  129. maxUnavailable: 100%
  130. type: RollingUpdate
  131. selector:
  132. matchLabels:
  133. app: ovn-central
  134. template:
  135. metadata:
  136. labels:
  137. app: ovn-central
  138. component: network
  139. type: infra
  140. spec:
  141. tolerations:
  142. - operator: Exists
  143. effect: NoSchedule
  144. affinity:
  145. podAntiAffinity:
  146. requiredDuringSchedulingIgnoredDuringExecution:
  147. - labelSelector:
  148. matchLabels:
  149. app: ovn-central
  150. topologyKey: kubernetes.io/hostname
  151. priorityClassName: system-cluster-critical
  152. serviceAccountName: ovn
  153. hostNetwork: true
  154. containers:
  155. - name: ovn-central
  156. image: {{ kube_ovn_container_image_repo }}:{{ kube_ovn_container_image_tag }}
  157. imagePullPolicy: {{ k8s_image_pull_policy }}
  158. command: ["/kube-ovn/start-db.sh"]
  159. securityContext:
  160. capabilities:
  161. add: ["SYS_NICE"]
  162. env:
  163. - name: POD_IP
  164. valueFrom:
  165. fieldRef:
  166. fieldPath: status.podIP
  167. - name: POD_NAME
  168. valueFrom:
  169. fieldRef:
  170. fieldPath: metadata.name
  171. - name: POD_NAMESPACE
  172. valueFrom:
  173. fieldRef:
  174. fieldPath: metadata.namespace
  175. resources:
  176. requests:
  177. cpu: {{ kube_ovn_db_cpu_request }}
  178. memory: {{ kube_ovn_db_memory_request }}
  179. limits:
  180. cpu: {{ kube_ovn_db_cpu_limit }}
  181. memory: {{ kube_ovn_db_memory_limit }}
  182. volumeMounts:
  183. - mountPath: /var/run/openvswitch
  184. name: host-run-ovs
  185. - mountPath: /var/run/ovn
  186. name: host-run-ovn
  187. - mountPath: /sys
  188. name: host-sys
  189. readOnly: true
  190. - mountPath: /etc/openvswitch
  191. name: host-config-openvswitch
  192. - mountPath: /etc/ovn
  193. name: host-config-ovn
  194. - mountPath: /var/log/openvswitch
  195. name: host-log-ovs
  196. - mountPath: /var/log/ovn
  197. name: host-log-ovn
  198. readinessProbe:
  199. exec:
  200. command:
  201. - sh
  202. - /kube-ovn/ovn-is-leader.sh
  203. periodSeconds: 3
  204. livenessProbe:
  205. exec:
  206. command:
  207. - sh
  208. - /kube-ovn/ovn-healthcheck.sh
  209. initialDelaySeconds: 30
  210. periodSeconds: 7
  211. failureThreshold: 5
  212. nodeSelector:
  213. kubernetes.io/os: "linux"
  214. kube-ovn/role: "master"
  215. volumes:
  216. - name: host-run-ovs
  217. hostPath:
  218. path: /run/openvswitch
  219. - name: host-run-ovn
  220. hostPath:
  221. path: /run/ovn
  222. - name: host-sys
  223. hostPath:
  224. path: /sys
  225. - name: host-config-openvswitch
  226. hostPath:
  227. path: /etc/origin/openvswitch
  228. - name: host-config-ovn
  229. hostPath:
  230. path: /etc/origin/ovn
  231. - name: host-log-ovs
  232. hostPath:
  233. path: /var/log/openvswitch
  234. - name: host-log-ovn
  235. hostPath:
  236. path: /var/log/ovn
  237. ---
  238. kind: DaemonSet
  239. apiVersion: apps/v1
  240. metadata:
  241. name: ovs-ovn
  242. namespace: kube-system
  243. annotations:
  244. kubernetes.io/description: |
  245. This daemon set launches the openvswitch daemon.
  246. spec:
  247. selector:
  248. matchLabels:
  249. app: ovs
  250. updateStrategy:
  251. type: OnDelete
  252. template:
  253. metadata:
  254. labels:
  255. app: ovs
  256. component: network
  257. type: infra
  258. spec:
  259. tolerations:
  260. - operator: Exists
  261. effect: NoSchedule
  262. priorityClassName: system-cluster-critical
  263. serviceAccountName: ovn
  264. hostNetwork: true
  265. hostPID: true
  266. containers:
  267. - name: openvswitch
  268. image: {{ kube_ovn_container_image_repo }}:{{ kube_ovn_container_image_tag }}
  269. imagePullPolicy: {{ k8s_image_pull_policy }}
  270. command: ["/kube-ovn/start-ovs.sh"]
  271. securityContext:
  272. runAsUser: 0
  273. privileged: true
  274. env:
  275. - name: POD_IP
  276. valueFrom:
  277. fieldRef:
  278. fieldPath: status.podIP
  279. - name: HW_OFFLOAD
  280. value: "false"
  281. volumeMounts:
  282. - mountPath: /lib/modules
  283. name: host-modules
  284. readOnly: true
  285. - mountPath: /var/run/openvswitch
  286. name: host-run-ovs
  287. - mountPath: /var/run/ovn
  288. name: host-run-ovn
  289. - mountPath: /sys
  290. name: host-sys
  291. readOnly: true
  292. - mountPath: /etc/openvswitch
  293. name: host-config-openvswitch
  294. - mountPath: /etc/ovn
  295. name: host-config-ovn
  296. - mountPath: /var/log/openvswitch
  297. name: host-log-ovs
  298. - mountPath: /var/log/ovn
  299. name: host-log-ovn
  300. readinessProbe:
  301. exec:
  302. command:
  303. - sh
  304. - /kube-ovn/ovs-healthcheck.sh
  305. periodSeconds: 5
  306. livenessProbe:
  307. exec:
  308. command:
  309. - sh
  310. - /kube-ovn/ovs-healthcheck.sh
  311. initialDelaySeconds: 10
  312. periodSeconds: 5
  313. failureThreshold: 5
  314. resources:
  315. requests:
  316. cpu: {{ kube_ovn_node_cpu_request }}
  317. memory: {{ kube_ovn_node_memory_request }}
  318. limits:
  319. cpu: {{ kube_ovn_node_cpu_limit }}
  320. memory: {{ kube_ovn_node_memory_limit }}
  321. nodeSelector:
  322. kubernetes.io/os: "linux"
  323. volumes:
  324. - name: host-modules
  325. hostPath:
  326. path: /lib/modules
  327. - name: host-run-ovs
  328. hostPath:
  329. path: /run/openvswitch
  330. - name: host-run-ovn
  331. hostPath:
  332. path: /run/ovn
  333. - name: host-sys
  334. hostPath:
  335. path: /sys
  336. - name: host-config-openvswitch
  337. hostPath:
  338. path: /etc/origin/openvswitch
  339. - name: host-config-ovn
  340. hostPath:
  341. path: /etc/origin/ovn
  342. - name: host-log-ovs
  343. hostPath:
  344. path: /var/log/openvswitch
  345. - name: host-log-ovn
  346. hostPath:
  347. path: /var/log/ovn