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.

343 lines
8.0 KiB

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