1. ---
    2. kind: ClusterRoleBinding
    3. apiVersion: rbac.authorization.k8s.io/v1
    4. metadata:
    5. name: flannel
    6. roleRef:
    7. apiGroup: rbac.authorization.k8s.io
    8. kind: ClusterRole
    9. name: flannel
    10. subjects:
    11. - kind: ServiceAccount
    12. name: flannel
    13. namespace: kube-system
    14. ---
    15. kind: ClusterRole
    16. apiVersion: rbac.authorization.k8s.io/v1
    17. metadata:
    18. name: flannel
    19. rules:
    20. - apiGroups:
    21. - ""
    22. resources:
    23. - pods
    24. verbs:
    25. - get
    26. - apiGroups:
    27. - ""
    28. resources:
    29. - nodes
    30. verbs:
    31. - list
    32. - watch
    33. - apiGroups:
    34. - ""
    35. resources:
    36. - nodes/status
    37. verbs:
    38. - patch
    39. ---
    40. kind: ConfigMap
    41. apiVersion: v1
    42. metadata:
    43. name: kube-flannel-cfg
    44. namespace: "kube-system"
    45. labels:
    46. tier: node
    47. app: flannel
    48. data:
    49. cni-conf.json: |
    50. {
    51. "name":"cbr0",
    52. "cniVersion":"0.3.1",
    53. "plugins":[
    54. {
    55. "delegate":{
    56. "forceAddress":true,
    57. "isDefaultGateway":true
    58. }
    59. {
    60. "type":"portmap",
    61. "capabilities":{
    62. "portMappings":true
    63. }
    64. }
    65. ]
    66. }
    67. net-conf.json: |
    68. {
    69. "Network": "10.42.0.0/16",
    70. "Backend": {
    71. "Type": "vxlan"
    72. }
    73. }
    74. ---
    75. apiVersion: extensions/v1beta1
    76. kind: DaemonSet
    77. metadata:
    78. name: kube-flannel
    79. namespace: "kube-system"
    80. labels:
    81. tier: node
    82. k8s-app: flannel
    83. spec:
    84. template:
    85. metadata:
    86. labels:
    87. tier: node
    88. k8s-app: flannel
    89. spec:
    90. affinity:
    91. nodeAffinity:
    92. requiredDuringSchedulingIgnoredDuringExecution:
    93. nodeSelectorTerms:
    94. - matchExpressions:
    95. - key: beta.kubernetes.io/os
    96. operator: NotIn
    97. values:
    98. - windows
    99. serviceAccountName: flannel
    100. containers:
    101. - name: kube-flannel
    102. image: rancher/coreos-flannel:v0.10.0-rancher1
    103. imagePullPolicy: IfNotPresent
    104. resources:
    105. limits:
    106. cpu: 300m
    107. memory: 500M
    108. requests:
    109. cpu: 150m
    110. memory: 64M
    111. command: ["/opt/bin/flanneld","--ip-masq","--kube-subnet-mgr"]
    112. securityContext:
    113. privileged: true
    114. env:
    115. valueFrom:
    116. fieldRef:
    117. - name: POD_NAMESPACE
    118. valueFrom:
    119. fieldRef:
    120. fieldPath: metadata.namespace
    121. volumeMounts:
    122. - name: run
    123. mountPath: /run
    124. - name: cni
    125. mountPath: /etc/cni/net.d
    126. - name: flannel-cfg
    127. mountPath: /etc/kube-flannel/
    128. - name: install-cni
    129. image: rancher/flannel-cni:v0.3.0-rancher1
    130. command: ["/install-cni.sh"]
    131. env:
    132. # The CNI network config to install on each node.
    133. - name: CNI_NETWORK_CONFIG
    134. valueFrom:
    135. configMapKeyRef:
    136. name: kube-flannel-cfg
    137. key: cni-conf.json
    138. - name: CNI_CONF_NAME
    139. value: "10-flannel.conflist"
    140. volumeMounts:
    141. - name: cni
    142. mountPath: /host/etc/cni/net.d
    143. - name: host-cni-bin
    144. mountPath: /host/opt/cni/bin/
    145. hostNetwork: true
    146. tolerations:
    147. - operator: Exists
    148. effect: NoSchedule
    149. - operator: Exists
    150. effect: NoExecute
    151. - key: node.kubernetes.io/not-ready
    152. effect: NoSchedule
    153. operator: Exists
    154. volumes:
    155. - name: run
    156. hostPath:
    157. path: /run
    158. - name: cni
    159. hostPath:
    160. path: /etc/cni/net.d
    161. - name: flannel-cfg
    162. configMap:
    163. name: kube-flannel-cfg
    164. - name: host-cni-bin
    165. hostPath:
    166. path: /opt/cni/bin
    167. updateStrategy:
    168. rollingUpdate:
    169. maxUnavailable: 20%
    170. type: RollingUpdate
    171. ---
    172. apiVersion: v1
    173. kind: ServiceAccount
    174. metadata: