kube-flannel.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. ---
  2. kind: ClusterRole
  3. apiVersion: rbac.authorization.k8s.io/v1beta1
  4. metadata:
  5. name: flannel
  6. rules:
  7. - apiGroups:
  8. - ""
  9. resources:
  10. - pods
  11. verbs:
  12. - get
  13. - apiGroups:
  14. - ""
  15. resources:
  16. - nodes
  17. verbs:
  18. - list
  19. - watch
  20. - apiGroups:
  21. - ""
  22. resources:
  23. - nodes/status
  24. verbs:
  25. - patch
  26. ---
  27. kind: ClusterRoleBinding
  28. apiVersion: rbac.authorization.k8s.io/v1beta1
  29. metadata:
  30. name: flannel
  31. roleRef:
  32. apiGroup: rbac.authorization.k8s.io
  33. kind: ClusterRole
  34. name: flannel
  35. subjects:
  36. - kind: ServiceAccount
  37. name: flannel
  38. namespace: kube-system
  39. ---
  40. apiVersion: v1
  41. kind: ServiceAccount
  42. metadata:
  43. name: flannel
  44. namespace: kube-system
  45. ---
  46. kind: ConfigMap
  47. apiVersion: v1
  48. metadata:
  49. name: kube-flannel-cfg
  50. namespace: kube-system
  51. labels:
  52. tier: node
  53. app: flannel
  54. data:
  55. cni-conf.json: |
  56. {
  57. "name": "cbr0",
  58. "plugins": [
  59. {
  60. "type": "flannel",
  61. "delegate": {
  62. "hairpinMode": true,
  63. "isDefaultGateway": true
  64. }
  65. },
  66. {
  67. "type": "portmap",
  68. "capabilities": {
  69. "portMappings": true
  70. }
  71. }
  72. ]
  73. }
  74. net-conf.json: |
  75. {
  76. "Network": "10.244.0.0/16",
  77. "Backend": {
  78. "Type": "vxlan"
  79. }
  80. }
  81. ---
  82. apiVersion: extensions/v1beta1
  83. kind: DaemonSet
  84. metadata:
  85. name: kube-flannel-ds
  86. namespace: kube-system
  87. labels:
  88. tier: node
  89. app: flannel
  90. spec:
  91. template:
  92. metadata:
  93. labels:
  94. tier: node
  95. app: flannel
  96. spec:
  97. hostNetwork: true
  98. nodeSelector:
  99. beta.kubernetes.io/arch: amd64
  100. tolerations:
  101. - key: node-role.kubernetes.io/master
  102. operator: Exists
  103. effect: NoSchedule
  104. serviceAccountName: flannel
  105. initContainers:
  106. - name: install-cni
  107. image: quay.io/coreos/flannel:v0.9.1-amd64
  108. command:
  109. - cp
  110. args:
  111. - -f
  112. - /etc/kube-flannel/cni-conf.json
  113. - /etc/cni/net.d/10-flannel.conflist
  114. volumeMounts:
  115. - name: cni
  116. mountPath: /etc/cni/net.d
  117. - name: flannel-cfg
  118. mountPath: /etc/kube-flannel/
  119. containers:
  120. - name: kube-flannel
  121. image: quay.io/coreos/flannel:v0.9.1-amd64
  122. command:
  123. - /opt/bin/flanneld
  124. args:
  125. - --ip-masq
  126. - --kube-subnet-mgr
  127. securityContext:
  128. privileged: true
  129. env:
  130. - name: POD_NAME
  131. valueFrom:
  132. fieldRef:
  133. fieldPath: metadata.name
  134. - name: POD_NAMESPACE
  135. valueFrom:
  136. fieldRef:
  137. fieldPath: metadata.namespace
  138. volumeMounts:
  139. - name: run
  140. mountPath: /run
  141. - name: flannel-cfg
  142. mountPath: /etc/kube-flannel/
  143. volumes:
  144. - name: run
  145. hostPath:
  146. path: /run
  147. - name: cni
  148. hostPath:
  149. path: /etc/cni/net.d
  150. - name: flannel-cfg
  151. configMap:
  152. name: kube-flannel-cfg