kube-flannel.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. apiVersion: v1
  2. kind: Namespace
  3. metadata:
  4. labels:
  5. k8s-app: flannel
  6. pod-security.kubernetes.io/enforce: privileged
  7. name: kube-flannel
  8. ---
  9. apiVersion: v1
  10. kind: ServiceAccount
  11. metadata:
  12. labels:
  13. k8s-app: flannel
  14. name: flannel
  15. namespace: kube-flannel
  16. ---
  17. apiVersion: rbac.authorization.k8s.io/v1
  18. kind: ClusterRole
  19. metadata:
  20. labels:
  21. k8s-app: flannel
  22. name: flannel
  23. rules:
  24. - apiGroups:
  25. - ""
  26. resources:
  27. - pods
  28. verbs:
  29. - get
  30. - apiGroups:
  31. - ""
  32. resources:
  33. - nodes
  34. verbs:
  35. - get
  36. - list
  37. - watch
  38. - apiGroups:
  39. - ""
  40. resources:
  41. - nodes/status
  42. verbs:
  43. - patch
  44. - apiGroups:
  45. - networking.k8s.io
  46. resources:
  47. - clustercidrs
  48. verbs:
  49. - list
  50. - watch
  51. ---
  52. apiVersion: rbac.authorization.k8s.io/v1
  53. kind: ClusterRoleBinding
  54. metadata:
  55. labels:
  56. k8s-app: flannel
  57. name: flannel
  58. roleRef:
  59. apiGroup: rbac.authorization.k8s.io
  60. kind: ClusterRole
  61. name: flannel
  62. subjects:
  63. - kind: ServiceAccount
  64. name: flannel
  65. namespace: kube-flannel
  66. ---
  67. apiVersion: v1
  68. data:
  69. cni-conf.json: |
  70. {
  71. "name": "cbr0",
  72. "cniVersion": "0.3.1",
  73. "plugins": [
  74. {
  75. "type": "flannel",
  76. "delegate": {
  77. "hairpinMode": true,
  78. "isDefaultGateway": true
  79. }
  80. },
  81. {
  82. "type": "portmap",
  83. "capabilities": {
  84. "portMappings": true
  85. }
  86. }
  87. ]
  88. }
  89. net-conf.json: |
  90. {
  91. "Network": "10.244.0.0/16",
  92. "Backend": {
  93. "Type": "vxlan"
  94. }
  95. }
  96. kind: ConfigMap
  97. metadata:
  98. labels:
  99. app: flannel
  100. k8s-app: flannel
  101. tier: node
  102. name: kube-flannel-cfg
  103. namespace: kube-flannel
  104. ---
  105. apiVersion: apps/v1
  106. kind: DaemonSet
  107. metadata:
  108. labels:
  109. app: flannel
  110. k8s-app: flannel
  111. tier: node
  112. name: kube-flannel-ds
  113. namespace: kube-flannel
  114. spec:
  115. selector:
  116. matchLabels:
  117. app: flannel
  118. k8s-app: flannel
  119. template:
  120. metadata:
  121. labels:
  122. app: flannel
  123. k8s-app: flannel
  124. tier: node
  125. spec:
  126. affinity:
  127. nodeAffinity:
  128. requiredDuringSchedulingIgnoredDuringExecution:
  129. nodeSelectorTerms:
  130. - matchExpressions:
  131. - key: kubernetes.io/os
  132. operator: In
  133. values:
  134. - linux
  135. containers:
  136. - args:
  137. - --ip-masq
  138. - --kube-subnet-mgr
  139. - --iface-regex=wg.*
  140. command:
  141. - /opt/bin/flanneld
  142. env:
  143. - name: POD_NAME
  144. valueFrom:
  145. fieldRef:
  146. fieldPath: metadata.name
  147. - name: POD_NAMESPACE
  148. valueFrom:
  149. fieldRef:
  150. fieldPath: metadata.namespace
  151. - name: EVENT_QUEUE_DEPTH
  152. value: "5000"
  153. image: docker.io/flannel/flannel:v0.21.2
  154. name: kube-flannel
  155. resources:
  156. requests:
  157. cpu: 100m
  158. memory: 50Mi
  159. securityContext:
  160. capabilities:
  161. add:
  162. - NET_ADMIN
  163. - NET_RAW
  164. privileged: false
  165. volumeMounts:
  166. - mountPath: /run/flannel
  167. name: run
  168. - mountPath: /etc/kube-flannel/
  169. name: flannel-cfg
  170. - mountPath: /run/xtables.lock
  171. name: xtables-lock
  172. hostNetwork: true
  173. initContainers:
  174. - args:
  175. - -f
  176. - /flannel
  177. - /opt/cni/bin/flannel
  178. command:
  179. - cp
  180. image: docker.io/flannel/flannel-cni-plugin:v1.1.2
  181. name: install-cni-plugin
  182. volumeMounts:
  183. - mountPath: /opt/cni/bin
  184. name: cni-plugin
  185. - args:
  186. - -f
  187. - /etc/kube-flannel/cni-conf.json
  188. - /etc/cni/net.d/10-flannel.conflist
  189. command:
  190. - cp
  191. image: docker.io/flannel/flannel:v0.21.2
  192. name: install-cni
  193. volumeMounts:
  194. - mountPath: /etc/cni/net.d
  195. name: cni
  196. - mountPath: /etc/kube-flannel/
  197. name: flannel-cfg
  198. priorityClassName: system-node-critical
  199. serviceAccountName: flannel
  200. tolerations:
  201. - effect: NoSchedule
  202. operator: Exists
  203. volumes:
  204. - hostPath:
  205. path: /run/flannel
  206. name: run
  207. - hostPath:
  208. path: /opt/cni/bin
  209. name: cni-plugin
  210. - hostPath:
  211. path: /etc/cni/net.d
  212. name: cni
  213. - configMap:
  214. name: kube-flannel-cfg
  215. name: flannel-cfg
  216. - hostPath:
  217. path: /run/xtables.lock
  218. type: FileOrCreate
  219. name: xtables-lock