kube-flannel.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. ---
  2. apiVersion: policy/v1beta1
  3. kind: PodSecurityPolicy
  4. metadata:
  5. name: psp.flannel.unprivileged
  6. annotations:
  7. seccomp.security.alpha.kubernetes.io/allowedProfileNames: docker/default
  8. seccomp.security.alpha.kubernetes.io/defaultProfileName: docker/default
  9. apparmor.security.beta.kubernetes.io/allowedProfileNames: runtime/default
  10. apparmor.security.beta.kubernetes.io/defaultProfileName: runtime/default
  11. spec:
  12. privileged: false
  13. volumes:
  14. - configMap
  15. - secret
  16. - emptyDir
  17. - hostPath
  18. allowedHostPaths:
  19. - pathPrefix: "/etc/cni/net.d"
  20. - pathPrefix: "/etc/kube-flannel"
  21. - pathPrefix: "/run/flannel"
  22. readOnlyRootFilesystem: false
  23. # Users and groups
  24. runAsUser:
  25. rule: RunAsAny
  26. supplementalGroups:
  27. rule: RunAsAny
  28. fsGroup:
  29. rule: RunAsAny
  30. # Privilege Escalation
  31. allowPrivilegeEscalation: false
  32. defaultAllowPrivilegeEscalation: false
  33. # Capabilities
  34. allowedCapabilities: ['NET_ADMIN']
  35. defaultAddCapabilities: []
  36. requiredDropCapabilities: []
  37. # Host namespaces
  38. hostPID: false
  39. hostIPC: false
  40. hostNetwork: true
  41. hostPorts:
  42. - min: 0
  43. max: 65535
  44. # SELinux
  45. seLinux:
  46. # SELinux is unsed in CaaSP
  47. rule: 'RunAsAny'
  48. ---
  49. kind: ClusterRole
  50. apiVersion: rbac.authorization.k8s.io/v1beta1
  51. metadata:
  52. name: flannel
  53. rules:
  54. - apiGroups: ['extensions']
  55. resources: ['podsecuritypolicies']
  56. verbs: ['use']
  57. resourceNames: ['psp.flannel.unprivileged']
  58. - apiGroups:
  59. - ""
  60. resources:
  61. - pods
  62. verbs:
  63. - get
  64. - apiGroups:
  65. - ""
  66. resources:
  67. - nodes
  68. verbs:
  69. - list
  70. - watch
  71. - apiGroups:
  72. - ""
  73. resources:
  74. - nodes/status
  75. verbs:
  76. - patch
  77. ---
  78. kind: ClusterRoleBinding
  79. apiVersion: rbac.authorization.k8s.io/v1beta1
  80. metadata:
  81. name: flannel
  82. roleRef:
  83. apiGroup: rbac.authorization.k8s.io
  84. kind: ClusterRole
  85. name: flannel
  86. subjects:
  87. - kind: ServiceAccount
  88. name: flannel
  89. namespace: kube-system
  90. ---
  91. apiVersion: v1
  92. kind: ServiceAccount
  93. metadata:
  94. name: flannel
  95. namespace: kube-system
  96. ---
  97. kind: ConfigMap
  98. apiVersion: v1
  99. metadata:
  100. name: kube-flannel-cfg
  101. namespace: kube-system
  102. labels:
  103. tier: node
  104. app: flannel
  105. data:
  106. cni-conf.json: |
  107. {
  108. "name": "cbr0",
  109. "plugins": [
  110. {
  111. "type": "flannel",
  112. "delegate": {
  113. "hairpinMode": true,
  114. "isDefaultGateway": true
  115. }
  116. },
  117. {
  118. "type": "portmap",
  119. "capabilities": {
  120. "portMappings": true
  121. }
  122. }
  123. ]
  124. }
  125. net-conf.json: |
  126. {
  127. "Network": "10.244.0.0/16",
  128. "Backend": {
  129. "Type": "vxlan"
  130. }
  131. }
  132. ---
  133. apiVersion: apps/v1
  134. kind: DaemonSet
  135. metadata:
  136. name: kube-flannel-ds-amd64
  137. namespace: kube-system
  138. labels:
  139. tier: node
  140. app: flannel
  141. spec:
  142. selector:
  143. matchLabels:
  144. app: flannel
  145. template:
  146. metadata:
  147. labels:
  148. tier: node
  149. app: flannel
  150. spec:
  151. affinity:
  152. nodeAffinity:
  153. requiredDuringSchedulingIgnoredDuringExecution:
  154. nodeSelectorTerms:
  155. - matchExpressions:
  156. - key: beta.kubernetes.io/os
  157. operator: In
  158. values:
  159. - linux
  160. - key: beta.kubernetes.io/arch
  161. operator: In
  162. values:
  163. - amd64
  164. hostNetwork: true
  165. tolerations:
  166. - operator: Exists
  167. effect: NoSchedule
  168. serviceAccountName: flannel
  169. initContainers:
  170. - name: install-cni
  171. image: quay.io/coreos/flannel:v0.11.0-amd64
  172. command:
  173. - cp
  174. args:
  175. - -f
  176. - /etc/kube-flannel/cni-conf.json
  177. - /etc/cni/net.d/10-flannel.conflist
  178. volumeMounts:
  179. - name: cni
  180. mountPath: /etc/cni/net.d
  181. - name: flannel-cfg
  182. mountPath: /etc/kube-flannel/
  183. containers:
  184. - name: kube-flannel
  185. image: quay.io/coreos/flannel:v0.11.0-amd64
  186. command:
  187. - /opt/bin/flanneld
  188. args:
  189. - --ip-masq
  190. - --kube-subnet-mgr
  191. resources:
  192. requests:
  193. cpu: "100m"
  194. memory: "50Mi"
  195. limits:
  196. cpu: "100m"
  197. memory: "50Mi"
  198. securityContext:
  199. privileged: false
  200. capabilities:
  201. add: ["NET_ADMIN"]
  202. env:
  203. - name: POD_NAME
  204. valueFrom:
  205. fieldRef:
  206. fieldPath: metadata.name
  207. - name: POD_NAMESPACE
  208. valueFrom:
  209. fieldRef:
  210. fieldPath: metadata.namespace
  211. volumeMounts:
  212. - name: run
  213. mountPath: /run/flannel
  214. - name: flannel-cfg
  215. mountPath: /etc/kube-flannel/
  216. volumes:
  217. - name: run
  218. hostPath:
  219. path: /run/flannel
  220. - name: cni
  221. hostPath:
  222. path: /etc/cni/net.d
  223. - name: flannel-cfg
  224. configMap:
  225. name: kube-flannel-cfg
  226. ---
  227. apiVersion: apps/v1
  228. kind: DaemonSet
  229. metadata:
  230. name: kube-flannel-ds-arm64
  231. namespace: kube-system
  232. labels:
  233. tier: node
  234. app: flannel
  235. spec:
  236. selector:
  237. matchLabels:
  238. app: flannel
  239. template:
  240. metadata:
  241. labels:
  242. tier: node
  243. app: flannel
  244. spec:
  245. affinity:
  246. nodeAffinity:
  247. requiredDuringSchedulingIgnoredDuringExecution:
  248. nodeSelectorTerms:
  249. - matchExpressions:
  250. - key: beta.kubernetes.io/os
  251. operator: In
  252. values:
  253. - linux
  254. - key: beta.kubernetes.io/arch
  255. operator: In
  256. values:
  257. - arm64
  258. hostNetwork: true
  259. tolerations:
  260. - operator: Exists
  261. effect: NoSchedule
  262. serviceAccountName: flannel
  263. initContainers:
  264. - name: install-cni
  265. image: quay.io/coreos/flannel:v0.11.0-arm64
  266. command:
  267. - cp
  268. args:
  269. - -f
  270. - /etc/kube-flannel/cni-conf.json
  271. - /etc/cni/net.d/10-flannel.conflist
  272. volumeMounts:
  273. - name: cni
  274. mountPath: /etc/cni/net.d
  275. - name: flannel-cfg
  276. mountPath: /etc/kube-flannel/
  277. containers:
  278. - name: kube-flannel
  279. image: quay.io/coreos/flannel:v0.11.0-arm64
  280. command:
  281. - /opt/bin/flanneld
  282. args:
  283. - --ip-masq
  284. - --kube-subnet-mgr
  285. resources:
  286. requests:
  287. cpu: "100m"
  288. memory: "50Mi"
  289. limits:
  290. cpu: "100m"
  291. memory: "50Mi"
  292. securityContext:
  293. privileged: false
  294. capabilities:
  295. add: ["NET_ADMIN"]
  296. env:
  297. - name: POD_NAME
  298. valueFrom:
  299. fieldRef:
  300. fieldPath: metadata.name
  301. - name: POD_NAMESPACE
  302. valueFrom:
  303. fieldRef:
  304. fieldPath: metadata.namespace
  305. volumeMounts:
  306. - name: run
  307. mountPath: /run/flannel
  308. - name: flannel-cfg
  309. mountPath: /etc/kube-flannel/
  310. volumes:
  311. - name: run
  312. hostPath:
  313. path: /run/flannel
  314. - name: cni
  315. hostPath:
  316. path: /etc/cni/net.d
  317. - name: flannel-cfg
  318. configMap:
  319. name: kube-flannel-cfg
  320. ---
  321. apiVersion: apps/v1
  322. kind: DaemonSet
  323. metadata:
  324. name: kube-flannel-ds-arm
  325. namespace: kube-system
  326. labels:
  327. tier: node
  328. app: flannel
  329. spec:
  330. selector:
  331. matchLabels:
  332. app: flannel
  333. template:
  334. metadata:
  335. labels:
  336. tier: node
  337. app: flannel
  338. spec:
  339. affinity:
  340. nodeAffinity:
  341. requiredDuringSchedulingIgnoredDuringExecution:
  342. nodeSelectorTerms:
  343. - matchExpressions:
  344. - key: beta.kubernetes.io/os
  345. operator: In
  346. values:
  347. - linux
  348. - key: beta.kubernetes.io/arch
  349. operator: In
  350. values:
  351. - arm
  352. hostNetwork: true
  353. tolerations:
  354. - operator: Exists
  355. effect: NoSchedule
  356. serviceAccountName: flannel
  357. initContainers:
  358. - name: install-cni
  359. image: quay.io/coreos/flannel:v0.11.0-arm
  360. command:
  361. - cp
  362. args:
  363. - -f
  364. - /etc/kube-flannel/cni-conf.json
  365. - /etc/cni/net.d/10-flannel.conflist
  366. volumeMounts:
  367. - name: cni
  368. mountPath: /etc/cni/net.d
  369. - name: flannel-cfg
  370. mountPath: /etc/kube-flannel/
  371. containers:
  372. - name: kube-flannel
  373. image: quay.io/coreos/flannel:v0.11.0-arm
  374. command:
  375. - /opt/bin/flanneld
  376. args:
  377. - --ip-masq
  378. - --kube-subnet-mgr
  379. resources:
  380. requests:
  381. cpu: "100m"
  382. memory: "50Mi"
  383. limits:
  384. cpu: "100m"
  385. memory: "50Mi"
  386. securityContext:
  387. privileged: false
  388. capabilities:
  389. add: ["NET_ADMIN"]
  390. env:
  391. - name: POD_NAME
  392. valueFrom:
  393. fieldRef:
  394. fieldPath: metadata.name
  395. - name: POD_NAMESPACE
  396. valueFrom:
  397. fieldRef:
  398. fieldPath: metadata.namespace
  399. volumeMounts:
  400. - name: run
  401. mountPath: /run/flannel
  402. - name: flannel-cfg
  403. mountPath: /etc/kube-flannel/
  404. volumes:
  405. - name: run
  406. hostPath:
  407. path: /run/flannel
  408. - name: cni
  409. hostPath:
  410. path: /etc/cni/net.d
  411. - name: flannel-cfg
  412. configMap:
  413. name: kube-flannel-cfg
  414. ---
  415. apiVersion: apps/v1
  416. kind: DaemonSet
  417. metadata:
  418. name: kube-flannel-ds-ppc64le
  419. namespace: kube-system
  420. labels:
  421. tier: node
  422. app: flannel
  423. spec:
  424. selector:
  425. matchLabels:
  426. app: flannel
  427. template:
  428. metadata:
  429. labels:
  430. tier: node
  431. app: flannel
  432. spec:
  433. affinity:
  434. nodeAffinity:
  435. requiredDuringSchedulingIgnoredDuringExecution:
  436. nodeSelectorTerms:
  437. - matchExpressions:
  438. - key: beta.kubernetes.io/os
  439. operator: In
  440. values:
  441. - linux
  442. - key: beta.kubernetes.io/arch
  443. operator: In
  444. values:
  445. - ppc64le
  446. hostNetwork: true
  447. tolerations:
  448. - operator: Exists
  449. effect: NoSchedule
  450. serviceAccountName: flannel
  451. initContainers:
  452. - name: install-cni
  453. image: quay.io/coreos/flannel:v0.11.0-ppc64le
  454. command:
  455. - cp
  456. args:
  457. - -f
  458. - /etc/kube-flannel/cni-conf.json
  459. - /etc/cni/net.d/10-flannel.conflist
  460. volumeMounts:
  461. - name: cni
  462. mountPath: /etc/cni/net.d
  463. - name: flannel-cfg
  464. mountPath: /etc/kube-flannel/
  465. containers:
  466. - name: kube-flannel
  467. image: quay.io/coreos/flannel:v0.11.0-ppc64le
  468. command:
  469. - /opt/bin/flanneld
  470. args:
  471. - --ip-masq
  472. - --kube-subnet-mgr
  473. resources:
  474. requests:
  475. cpu: "100m"
  476. memory: "50Mi"
  477. limits:
  478. cpu: "100m"
  479. memory: "50Mi"
  480. securityContext:
  481. privileged: false
  482. capabilities:
  483. add: ["NET_ADMIN"]
  484. env:
  485. - name: POD_NAME
  486. valueFrom:
  487. fieldRef:
  488. fieldPath: metadata.name
  489. - name: POD_NAMESPACE
  490. valueFrom:
  491. fieldRef:
  492. fieldPath: metadata.namespace
  493. volumeMounts:
  494. - name: run
  495. mountPath: /run/flannel
  496. - name: flannel-cfg
  497. mountPath: /etc/kube-flannel/
  498. volumes:
  499. - name: run
  500. hostPath:
  501. path: /run/flannel
  502. - name: cni
  503. hostPath:
  504. path: /etc/cni/net.d
  505. - name: flannel-cfg
  506. configMap:
  507. name: kube-flannel-cfg
  508. ---
  509. apiVersion: apps/v1
  510. kind: DaemonSet
  511. metadata:
  512. name: kube-flannel-ds-s390x
  513. namespace: kube-system
  514. labels:
  515. tier: node
  516. app: flannel
  517. spec:
  518. selector:
  519. matchLabels:
  520. app: flannel
  521. template:
  522. metadata:
  523. labels:
  524. tier: node
  525. app: flannel
  526. spec:
  527. affinity:
  528. nodeAffinity:
  529. requiredDuringSchedulingIgnoredDuringExecution:
  530. nodeSelectorTerms:
  531. - matchExpressions:
  532. - key: beta.kubernetes.io/os
  533. operator: In
  534. values:
  535. - linux
  536. - key: beta.kubernetes.io/arch
  537. operator: In
  538. values:
  539. - s390x
  540. hostNetwork: true
  541. tolerations:
  542. - operator: Exists
  543. effect: NoSchedule
  544. serviceAccountName: flannel
  545. initContainers:
  546. - name: install-cni
  547. image: quay.io/coreos/flannel:v0.11.0-s390x
  548. command:
  549. - cp
  550. args:
  551. - -f
  552. - /etc/kube-flannel/cni-conf.json
  553. - /etc/cni/net.d/10-flannel.conflist
  554. volumeMounts:
  555. - name: cni
  556. mountPath: /etc/cni/net.d
  557. - name: flannel-cfg
  558. mountPath: /etc/kube-flannel/
  559. containers:
  560. - name: kube-flannel
  561. image: quay.io/coreos/flannel:v0.11.0-s390x
  562. command:
  563. - /opt/bin/flanneld
  564. args:
  565. - --ip-masq
  566. - --kube-subnet-mgr
  567. resources:
  568. requests:
  569. cpu: "100m"
  570. memory: "50Mi"
  571. limits:
  572. cpu: "100m"
  573. memory: "50Mi"
  574. securityContext:
  575. privileged: false
  576. capabilities:
  577. add: ["NET_ADMIN"]
  578. env:
  579. - name: POD_NAME
  580. valueFrom:
  581. fieldRef:
  582. fieldPath: metadata.name
  583. - name: POD_NAMESPACE
  584. valueFrom:
  585. fieldRef:
  586. fieldPath: metadata.namespace
  587. volumeMounts:
  588. - name: run
  589. mountPath: /run/flannel
  590. - name: flannel-cfg
  591. mountPath: /etc/kube-flannel/
  592. volumes:
  593. - name: run
  594. hostPath:
  595. path: /run/flannel
  596. - name: cni
  597. hostPath:
  598. path: /etc/cni/net.d
  599. - name: flannel-cfg
  600. configMap:
  601. name: kube-flannel-cfg