kube-flannel.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  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. "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. hostNetwork: true
  153. nodeSelector:
  154. beta.kubernetes.io/arch: amd64
  155. tolerations:
  156. - operator: Exists
  157. effect: NoSchedule
  158. serviceAccountName: flannel
  159. initContainers:
  160. - name: install-cni
  161. image: quay.io/coreos/flannel:v0.11.0-amd64
  162. command:
  163. - cp
  164. args:
  165. - -f
  166. - /etc/kube-flannel/cni-conf.json
  167. - /etc/cni/net.d/10-flannel.conflist
  168. volumeMounts:
  169. - name: cni
  170. mountPath: /etc/cni/net.d
  171. - name: flannel-cfg
  172. mountPath: /etc/kube-flannel/
  173. containers:
  174. - name: kube-flannel
  175. image: quay.io/coreos/flannel:v0.11.0-amd64
  176. command:
  177. - /opt/bin/flanneld
  178. args:
  179. - --ip-masq
  180. - --kube-subnet-mgr
  181. resources:
  182. requests:
  183. cpu: "100m"
  184. memory: "50Mi"
  185. limits:
  186. cpu: "100m"
  187. memory: "50Mi"
  188. securityContext:
  189. privileged: false
  190. capabilities:
  191. add: ["NET_ADMIN"]
  192. env:
  193. - name: POD_NAME
  194. valueFrom:
  195. fieldRef:
  196. fieldPath: metadata.name
  197. - name: POD_NAMESPACE
  198. valueFrom:
  199. fieldRef:
  200. fieldPath: metadata.namespace
  201. volumeMounts:
  202. - name: run
  203. mountPath: /run/flannel
  204. - name: flannel-cfg
  205. mountPath: /etc/kube-flannel/
  206. volumes:
  207. - name: run
  208. hostPath:
  209. path: /run/flannel
  210. - name: cni
  211. hostPath:
  212. path: /etc/cni/net.d
  213. - name: flannel-cfg
  214. configMap:
  215. name: kube-flannel-cfg
  216. ---
  217. apiVersion: apps/v1
  218. kind: DaemonSet
  219. metadata:
  220. name: kube-flannel-ds-arm64
  221. namespace: kube-system
  222. labels:
  223. tier: node
  224. app: flannel
  225. spec:
  226. selector:
  227. matchLabels:
  228. app: flannel
  229. template:
  230. metadata:
  231. labels:
  232. tier: node
  233. app: flannel
  234. spec:
  235. hostNetwork: true
  236. nodeSelector:
  237. beta.kubernetes.io/arch: arm64
  238. tolerations:
  239. - operator: Exists
  240. effect: NoSchedule
  241. serviceAccountName: flannel
  242. initContainers:
  243. - name: install-cni
  244. image: quay.io/coreos/flannel:v0.11.0-arm64
  245. command:
  246. - cp
  247. args:
  248. - -f
  249. - /etc/kube-flannel/cni-conf.json
  250. - /etc/cni/net.d/10-flannel.conflist
  251. volumeMounts:
  252. - name: cni
  253. mountPath: /etc/cni/net.d
  254. - name: flannel-cfg
  255. mountPath: /etc/kube-flannel/
  256. containers:
  257. - name: kube-flannel
  258. image: quay.io/coreos/flannel:v0.11.0-arm64
  259. command:
  260. - /opt/bin/flanneld
  261. args:
  262. - --ip-masq
  263. - --kube-subnet-mgr
  264. resources:
  265. requests:
  266. cpu: "100m"
  267. memory: "50Mi"
  268. limits:
  269. cpu: "100m"
  270. memory: "50Mi"
  271. securityContext:
  272. privileged: false
  273. capabilities:
  274. add: ["NET_ADMIN"]
  275. env:
  276. - name: POD_NAME
  277. valueFrom:
  278. fieldRef:
  279. fieldPath: metadata.name
  280. - name: POD_NAMESPACE
  281. valueFrom:
  282. fieldRef:
  283. fieldPath: metadata.namespace
  284. volumeMounts:
  285. - name: run
  286. mountPath: /run/flannel
  287. - name: flannel-cfg
  288. mountPath: /etc/kube-flannel/
  289. volumes:
  290. - name: run
  291. hostPath:
  292. path: /run/flannel
  293. - name: cni
  294. hostPath:
  295. path: /etc/cni/net.d
  296. - name: flannel-cfg
  297. configMap:
  298. name: kube-flannel-cfg
  299. ---
  300. apiVersion: apps/v1
  301. kind: DaemonSet
  302. metadata:
  303. name: kube-flannel-ds-arm
  304. namespace: kube-system
  305. labels:
  306. tier: node
  307. app: flannel
  308. spec:
  309. selector:
  310. matchLabels:
  311. app: flannel
  312. template:
  313. metadata:
  314. labels:
  315. tier: node
  316. app: flannel
  317. spec:
  318. hostNetwork: true
  319. nodeSelector:
  320. beta.kubernetes.io/arch: arm
  321. tolerations:
  322. - operator: Exists
  323. effect: NoSchedule
  324. serviceAccountName: flannel
  325. initContainers:
  326. - name: install-cni
  327. image: quay.io/coreos/flannel:v0.11.0-arm
  328. command:
  329. - cp
  330. args:
  331. - -f
  332. - /etc/kube-flannel/cni-conf.json
  333. - /etc/cni/net.d/10-flannel.conflist
  334. volumeMounts:
  335. - name: cni
  336. mountPath: /etc/cni/net.d
  337. - name: flannel-cfg
  338. mountPath: /etc/kube-flannel/
  339. containers:
  340. - name: kube-flannel
  341. image: quay.io/coreos/flannel:v0.11.0-arm
  342. command:
  343. - /opt/bin/flanneld
  344. args:
  345. - --ip-masq
  346. - --kube-subnet-mgr
  347. resources:
  348. requests:
  349. cpu: "100m"
  350. memory: "50Mi"
  351. limits:
  352. cpu: "100m"
  353. memory: "50Mi"
  354. securityContext:
  355. privileged: false
  356. capabilities:
  357. add: ["NET_ADMIN"]
  358. env:
  359. - name: POD_NAME
  360. valueFrom:
  361. fieldRef:
  362. fieldPath: metadata.name
  363. - name: POD_NAMESPACE
  364. valueFrom:
  365. fieldRef:
  366. fieldPath: metadata.namespace
  367. volumeMounts:
  368. - name: run
  369. mountPath: /run/flannel
  370. - name: flannel-cfg
  371. mountPath: /etc/kube-flannel/
  372. volumes:
  373. - name: run
  374. hostPath:
  375. path: /run/flannel
  376. - name: cni
  377. hostPath:
  378. path: /etc/cni/net.d
  379. - name: flannel-cfg
  380. configMap:
  381. name: kube-flannel-cfg
  382. ---
  383. apiVersion: apps/v1
  384. kind: DaemonSet
  385. metadata:
  386. name: kube-flannel-ds-ppc64le
  387. namespace: kube-system
  388. labels:
  389. tier: node
  390. app: flannel
  391. spec:
  392. selector:
  393. matchLabels:
  394. app: flannel
  395. template:
  396. metadata:
  397. labels:
  398. tier: node
  399. app: flannel
  400. spec:
  401. hostNetwork: true
  402. nodeSelector:
  403. beta.kubernetes.io/arch: ppc64le
  404. tolerations:
  405. - operator: Exists
  406. effect: NoSchedule
  407. serviceAccountName: flannel
  408. initContainers:
  409. - name: install-cni
  410. image: quay.io/coreos/flannel:v0.11.0-ppc64le
  411. command:
  412. - cp
  413. args:
  414. - -f
  415. - /etc/kube-flannel/cni-conf.json
  416. - /etc/cni/net.d/10-flannel.conflist
  417. volumeMounts:
  418. - name: cni
  419. mountPath: /etc/cni/net.d
  420. - name: flannel-cfg
  421. mountPath: /etc/kube-flannel/
  422. containers:
  423. - name: kube-flannel
  424. image: quay.io/coreos/flannel:v0.11.0-ppc64le
  425. command:
  426. - /opt/bin/flanneld
  427. args:
  428. - --ip-masq
  429. - --kube-subnet-mgr
  430. resources:
  431. requests:
  432. cpu: "100m"
  433. memory: "50Mi"
  434. limits:
  435. cpu: "100m"
  436. memory: "50Mi"
  437. securityContext:
  438. privileged: false
  439. capabilities:
  440. add: ["NET_ADMIN"]
  441. env:
  442. - name: POD_NAME
  443. valueFrom:
  444. fieldRef:
  445. fieldPath: metadata.name
  446. - name: POD_NAMESPACE
  447. valueFrom:
  448. fieldRef:
  449. fieldPath: metadata.namespace
  450. volumeMounts:
  451. - name: run
  452. mountPath: /run/flannel
  453. - name: flannel-cfg
  454. mountPath: /etc/kube-flannel/
  455. volumes:
  456. - name: run
  457. hostPath:
  458. path: /run/flannel
  459. - name: cni
  460. hostPath:
  461. path: /etc/cni/net.d
  462. - name: flannel-cfg
  463. configMap:
  464. name: kube-flannel-cfg
  465. ---
  466. apiVersion: apps/v1
  467. kind: DaemonSet
  468. metadata:
  469. name: kube-flannel-ds-s390x
  470. namespace: kube-system
  471. labels:
  472. tier: node
  473. app: flannel
  474. spec:
  475. selector:
  476. matchLabels:
  477. app: flannel
  478. template:
  479. metadata:
  480. labels:
  481. tier: node
  482. app: flannel
  483. spec:
  484. hostNetwork: true
  485. nodeSelector:
  486. beta.kubernetes.io/arch: s390x
  487. tolerations:
  488. - operator: Exists
  489. effect: NoSchedule
  490. serviceAccountName: flannel
  491. initContainers:
  492. - name: install-cni
  493. image: quay.io/coreos/flannel:v0.11.0-s390x
  494. command:
  495. - cp
  496. args:
  497. - -f
  498. - /etc/kube-flannel/cni-conf.json
  499. - /etc/cni/net.d/10-flannel.conflist
  500. volumeMounts:
  501. - name: cni
  502. mountPath: /etc/cni/net.d
  503. - name: flannel-cfg
  504. mountPath: /etc/kube-flannel/
  505. containers:
  506. - name: kube-flannel
  507. image: quay.io/coreos/flannel:v0.11.0-s390x
  508. command:
  509. - /opt/bin/flanneld
  510. args:
  511. - --ip-masq
  512. - --kube-subnet-mgr
  513. resources:
  514. requests:
  515. cpu: "100m"
  516. memory: "50Mi"
  517. limits:
  518. cpu: "100m"
  519. memory: "50Mi"
  520. securityContext:
  521. privileged: false
  522. capabilities:
  523. add: ["NET_ADMIN"]
  524. env:
  525. - name: POD_NAME
  526. valueFrom:
  527. fieldRef:
  528. fieldPath: metadata.name
  529. - name: POD_NAMESPACE
  530. valueFrom:
  531. fieldRef:
  532. fieldPath: metadata.namespace
  533. volumeMounts:
  534. - name: run
  535. mountPath: /run/flannel
  536. - name: flannel-cfg
  537. mountPath: /etc/kube-flannel/
  538. volumes:
  539. - name: run
  540. hostPath:
  541. path: /run/flannel
  542. - name: cni
  543. hostPath:
  544. path: /etc/cni/net.d
  545. - name: flannel-cfg
  546. configMap:
  547. name: kube-flannel-cfg