kube-flannel.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  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 unused 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. "cniVersion": "0.3.1",
  110. "plugins": [
  111. {
  112. "type": "flannel",
  113. "delegate": {
  114. "hairpinMode": true,
  115. "isDefaultGateway": true
  116. }
  117. },
  118. {
  119. "type": "portmap",
  120. "capabilities": {
  121. "portMappings": true
  122. }
  123. }
  124. ]
  125. }
  126. net-conf.json: |
  127. {
  128. "Network": "10.244.0.0/16",
  129. "Backend": {
  130. "Type": "vxlan"
  131. }
  132. }
  133. ---
  134. apiVersion: apps/v1
  135. kind: DaemonSet
  136. metadata:
  137. name: kube-flannel-ds-amd64
  138. namespace: kube-system
  139. labels:
  140. tier: node
  141. app: flannel
  142. spec:
  143. selector:
  144. matchLabels:
  145. app: flannel
  146. template:
  147. metadata:
  148. labels:
  149. tier: node
  150. app: flannel
  151. spec:
  152. affinity:
  153. nodeAffinity:
  154. requiredDuringSchedulingIgnoredDuringExecution:
  155. nodeSelectorTerms:
  156. - matchExpressions:
  157. - key: kubernetes.io/os
  158. operator: In
  159. values:
  160. - linux
  161. - key: kubernetes.io/arch
  162. operator: In
  163. values:
  164. - amd64
  165. hostNetwork: true
  166. priorityClassName: system-node-critical
  167. tolerations:
  168. - operator: Exists
  169. effect: NoSchedule
  170. serviceAccountName: flannel
  171. initContainers:
  172. - name: install-cni
  173. image: quay.io/coreos/flannel:v0.12.0-amd64
  174. command:
  175. - cp
  176. args:
  177. - -f
  178. - /etc/kube-flannel/cni-conf.json
  179. - /etc/cni/net.d/10-flannel.conflist
  180. volumeMounts:
  181. - name: cni
  182. mountPath: /etc/cni/net.d
  183. - name: flannel-cfg
  184. mountPath: /etc/kube-flannel/
  185. containers:
  186. - name: kube-flannel
  187. image: quay.io/coreos/flannel:v0.12.0-amd64
  188. command:
  189. - /opt/bin/flanneld
  190. args:
  191. - --ip-masq
  192. - --kube-subnet-mgr
  193. resources:
  194. requests:
  195. cpu: "100m"
  196. memory: "50Mi"
  197. limits:
  198. cpu: "100m"
  199. memory: "50Mi"
  200. securityContext:
  201. privileged: false
  202. capabilities:
  203. add: ["NET_ADMIN"]
  204. env:
  205. - name: POD_NAME
  206. valueFrom:
  207. fieldRef:
  208. fieldPath: metadata.name
  209. - name: POD_NAMESPACE
  210. valueFrom:
  211. fieldRef:
  212. fieldPath: metadata.namespace
  213. volumeMounts:
  214. - name: run
  215. mountPath: /run/flannel
  216. - name: flannel-cfg
  217. mountPath: /etc/kube-flannel/
  218. volumes:
  219. - name: run
  220. hostPath:
  221. path: /run/flannel
  222. - name: cni
  223. hostPath:
  224. path: /etc/cni/net.d
  225. - name: flannel-cfg
  226. configMap:
  227. name: kube-flannel-cfg
  228. ---
  229. apiVersion: apps/v1
  230. kind: DaemonSet
  231. metadata:
  232. name: kube-flannel-ds-arm64
  233. namespace: kube-system
  234. labels:
  235. tier: node
  236. app: flannel
  237. spec:
  238. selector:
  239. matchLabels:
  240. app: flannel
  241. template:
  242. metadata:
  243. labels:
  244. tier: node
  245. app: flannel
  246. spec:
  247. affinity:
  248. nodeAffinity:
  249. requiredDuringSchedulingIgnoredDuringExecution:
  250. nodeSelectorTerms:
  251. - matchExpressions:
  252. - key: kubernetes.io/os
  253. operator: In
  254. values:
  255. - linux
  256. - key: kubernetes.io/arch
  257. operator: In
  258. values:
  259. - arm64
  260. hostNetwork: true
  261. priorityClassName: system-node-critical
  262. tolerations:
  263. - operator: Exists
  264. effect: NoSchedule
  265. serviceAccountName: flannel
  266. initContainers:
  267. - name: install-cni
  268. image: quay.io/coreos/flannel:v0.12.0-arm64
  269. command:
  270. - cp
  271. args:
  272. - -f
  273. - /etc/kube-flannel/cni-conf.json
  274. - /etc/cni/net.d/10-flannel.conflist
  275. volumeMounts:
  276. - name: cni
  277. mountPath: /etc/cni/net.d
  278. - name: flannel-cfg
  279. mountPath: /etc/kube-flannel/
  280. containers:
  281. - name: kube-flannel
  282. image: quay.io/coreos/flannel:v0.12.0-arm64
  283. command:
  284. - /opt/bin/flanneld
  285. args:
  286. - --ip-masq
  287. - --kube-subnet-mgr
  288. resources:
  289. requests:
  290. cpu: "100m"
  291. memory: "50Mi"
  292. limits:
  293. cpu: "100m"
  294. memory: "50Mi"
  295. securityContext:
  296. privileged: false
  297. capabilities:
  298. add: ["NET_ADMIN"]
  299. env:
  300. - name: POD_NAME
  301. valueFrom:
  302. fieldRef:
  303. fieldPath: metadata.name
  304. - name: POD_NAMESPACE
  305. valueFrom:
  306. fieldRef:
  307. fieldPath: metadata.namespace
  308. volumeMounts:
  309. - name: run
  310. mountPath: /run/flannel
  311. - name: flannel-cfg
  312. mountPath: /etc/kube-flannel/
  313. volumes:
  314. - name: run
  315. hostPath:
  316. path: /run/flannel
  317. - name: cni
  318. hostPath:
  319. path: /etc/cni/net.d
  320. - name: flannel-cfg
  321. configMap:
  322. name: kube-flannel-cfg
  323. ---
  324. apiVersion: apps/v1
  325. kind: DaemonSet
  326. metadata:
  327. name: kube-flannel-ds-arm
  328. namespace: kube-system
  329. labels:
  330. tier: node
  331. app: flannel
  332. spec:
  333. selector:
  334. matchLabels:
  335. app: flannel
  336. template:
  337. metadata:
  338. labels:
  339. tier: node
  340. app: flannel
  341. spec:
  342. affinity:
  343. nodeAffinity:
  344. requiredDuringSchedulingIgnoredDuringExecution:
  345. nodeSelectorTerms:
  346. - matchExpressions:
  347. - key: kubernetes.io/os
  348. operator: In
  349. values:
  350. - linux
  351. - key: kubernetes.io/arch
  352. operator: In
  353. values:
  354. - arm
  355. hostNetwork: true
  356. priorityClassName: system-node-critical
  357. tolerations:
  358. - operator: Exists
  359. effect: NoSchedule
  360. serviceAccountName: flannel
  361. initContainers:
  362. - name: install-cni
  363. image: quay.io/coreos/flannel:v0.12.0-arm
  364. command:
  365. - cp
  366. args:
  367. - -f
  368. - /etc/kube-flannel/cni-conf.json
  369. - /etc/cni/net.d/10-flannel.conflist
  370. volumeMounts:
  371. - name: cni
  372. mountPath: /etc/cni/net.d
  373. - name: flannel-cfg
  374. mountPath: /etc/kube-flannel/
  375. containers:
  376. - name: kube-flannel
  377. image: quay.io/coreos/flannel:v0.12.0-arm
  378. command:
  379. - /opt/bin/flanneld
  380. args:
  381. - --ip-masq
  382. - --kube-subnet-mgr
  383. resources:
  384. requests:
  385. cpu: "100m"
  386. memory: "50Mi"
  387. limits:
  388. cpu: "100m"
  389. memory: "50Mi"
  390. securityContext:
  391. privileged: false
  392. capabilities:
  393. add: ["NET_ADMIN"]
  394. env:
  395. - name: POD_NAME
  396. valueFrom:
  397. fieldRef:
  398. fieldPath: metadata.name
  399. - name: POD_NAMESPACE
  400. valueFrom:
  401. fieldRef:
  402. fieldPath: metadata.namespace
  403. volumeMounts:
  404. - name: run
  405. mountPath: /run/flannel
  406. - name: flannel-cfg
  407. mountPath: /etc/kube-flannel/
  408. volumes:
  409. - name: run
  410. hostPath:
  411. path: /run/flannel
  412. - name: cni
  413. hostPath:
  414. path: /etc/cni/net.d
  415. - name: flannel-cfg
  416. configMap:
  417. name: kube-flannel-cfg
  418. ---
  419. apiVersion: apps/v1
  420. kind: DaemonSet
  421. metadata:
  422. name: kube-flannel-ds-ppc64le
  423. namespace: kube-system
  424. labels:
  425. tier: node
  426. app: flannel
  427. spec:
  428. selector:
  429. matchLabels:
  430. app: flannel
  431. template:
  432. metadata:
  433. labels:
  434. tier: node
  435. app: flannel
  436. spec:
  437. affinity:
  438. nodeAffinity:
  439. requiredDuringSchedulingIgnoredDuringExecution:
  440. nodeSelectorTerms:
  441. - matchExpressions:
  442. - key: kubernetes.io/os
  443. operator: In
  444. values:
  445. - linux
  446. - key: kubernetes.io/arch
  447. operator: In
  448. values:
  449. - ppc64le
  450. hostNetwork: true
  451. priorityClassName: system-node-critical
  452. tolerations:
  453. - operator: Exists
  454. effect: NoSchedule
  455. serviceAccountName: flannel
  456. initContainers:
  457. - name: install-cni
  458. image: quay.io/coreos/flannel:v0.12.0-ppc64le
  459. command:
  460. - cp
  461. args:
  462. - -f
  463. - /etc/kube-flannel/cni-conf.json
  464. - /etc/cni/net.d/10-flannel.conflist
  465. volumeMounts:
  466. - name: cni
  467. mountPath: /etc/cni/net.d
  468. - name: flannel-cfg
  469. mountPath: /etc/kube-flannel/
  470. containers:
  471. - name: kube-flannel
  472. image: quay.io/coreos/flannel:v0.12.0-ppc64le
  473. command:
  474. - /opt/bin/flanneld
  475. args:
  476. - --ip-masq
  477. - --kube-subnet-mgr
  478. resources:
  479. requests:
  480. cpu: "100m"
  481. memory: "50Mi"
  482. limits:
  483. cpu: "100m"
  484. memory: "50Mi"
  485. securityContext:
  486. privileged: false
  487. capabilities:
  488. add: ["NET_ADMIN"]
  489. env:
  490. - name: POD_NAME
  491. valueFrom:
  492. fieldRef:
  493. fieldPath: metadata.name
  494. - name: POD_NAMESPACE
  495. valueFrom:
  496. fieldRef:
  497. fieldPath: metadata.namespace
  498. volumeMounts:
  499. - name: run
  500. mountPath: /run/flannel
  501. - name: flannel-cfg
  502. mountPath: /etc/kube-flannel/
  503. volumes:
  504. - name: run
  505. hostPath:
  506. path: /run/flannel
  507. - name: cni
  508. hostPath:
  509. path: /etc/cni/net.d
  510. - name: flannel-cfg
  511. configMap:
  512. name: kube-flannel-cfg
  513. ---
  514. apiVersion: apps/v1
  515. kind: DaemonSet
  516. metadata:
  517. name: kube-flannel-ds-s390x
  518. namespace: kube-system
  519. labels:
  520. tier: node
  521. app: flannel
  522. spec:
  523. selector:
  524. matchLabels:
  525. app: flannel
  526. template:
  527. metadata:
  528. labels:
  529. tier: node
  530. app: flannel
  531. spec:
  532. affinity:
  533. nodeAffinity:
  534. requiredDuringSchedulingIgnoredDuringExecution:
  535. nodeSelectorTerms:
  536. - matchExpressions:
  537. - key: kubernetes.io/os
  538. operator: In
  539. values:
  540. - linux
  541. - key: kubernetes.io/arch
  542. operator: In
  543. values:
  544. - s390x
  545. hostNetwork: true
  546. priorityClassName: system-node-critical
  547. tolerations:
  548. - operator: Exists
  549. effect: NoSchedule
  550. serviceAccountName: flannel
  551. initContainers:
  552. - name: install-cni
  553. image: quay.io/coreos/flannel:v0.12.0-s390x
  554. command:
  555. - cp
  556. args:
  557. - -f
  558. - /etc/kube-flannel/cni-conf.json
  559. - /etc/cni/net.d/10-flannel.conflist
  560. volumeMounts:
  561. - name: cni
  562. mountPath: /etc/cni/net.d
  563. - name: flannel-cfg
  564. mountPath: /etc/kube-flannel/
  565. containers:
  566. - name: kube-flannel
  567. image: quay.io/coreos/flannel:v0.12.0-s390x
  568. command:
  569. - /opt/bin/flanneld
  570. args:
  571. - --ip-masq
  572. - --kube-subnet-mgr
  573. resources:
  574. requests:
  575. cpu: "100m"
  576. memory: "50Mi"
  577. limits:
  578. cpu: "100m"
  579. memory: "50Mi"
  580. securityContext:
  581. privileged: false
  582. capabilities:
  583. add: ["NET_ADMIN"]
  584. env:
  585. - name: POD_NAME
  586. valueFrom:
  587. fieldRef:
  588. fieldPath: metadata.name
  589. - name: POD_NAMESPACE
  590. valueFrom:
  591. fieldRef:
  592. fieldPath: metadata.namespace
  593. volumeMounts:
  594. - name: run
  595. mountPath: /run/flannel
  596. - name: flannel-cfg
  597. mountPath: /etc/kube-flannel/
  598. volumes:
  599. - name: run
  600. hostPath:
  601. path: /run/flannel
  602. - name: cni
  603. hostPath:
  604. path: /etc/cni/net.d
  605. - name: flannel-cfg
  606. configMap:
  607. name: kube-flannel-cfg