You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
3.6 KiB

  1. ---
  2. kind: ConfigMap
  3. apiVersion: v1
  4. metadata:
  5. name: kube-flannel-cfg
  6. namespace: "kube-system"
  7. labels:
  8. tier: node
  9. app: flannel
  10. data:
  11. cni-conf.json: |
  12. {
  13. "name":"cni0",
  14. "cniVersion":"0.3.1",
  15. "plugins":[
  16. {
  17. "type":"flannel",
  18. "delegate":{
  19. "forceAddress":true,
  20. "hairpinMode": true,
  21. "isDefaultGateway":true
  22. }
  23. },
  24. {
  25. "type":"portmap",
  26. "capabilities":{
  27. "portMappings":true
  28. }
  29. }
  30. ]
  31. }
  32. net-conf.json: |
  33. {
  34. "Network": "{{ kube_pods_subnet }}",
  35. "Backend": {
  36. "Type": "{{ flannel_backend_type }}"
  37. }
  38. }
  39. ---
  40. apiVersion: apps/v1
  41. kind: DaemonSet
  42. metadata:
  43. name: kube-flannel
  44. namespace: "kube-system"
  45. labels:
  46. tier: node
  47. k8s-app: flannel
  48. spec:
  49. selector:
  50. matchLabels:
  51. tier: node
  52. k8s-app: flannel
  53. template:
  54. metadata:
  55. labels:
  56. tier: node
  57. k8s-app: flannel
  58. spec:
  59. priorityClassName: system-node-critical
  60. serviceAccountName: flannel
  61. nodeSelector:
  62. beta.kubernetes.io/os: linux
  63. containers:
  64. - name: kube-flannel
  65. image: {{ flannel_image_repo }}:{{ flannel_image_tag }}
  66. imagePullPolicy: {{ k8s_image_pull_policy }}
  67. resources:
  68. limits:
  69. cpu: {{ flannel_cpu_limit }}
  70. memory: {{ flannel_memory_limit }}
  71. requests:
  72. cpu: {{ flannel_cpu_requests }}
  73. memory: {{ flannel_memory_requests }}
  74. command: [ "/opt/bin/flanneld", "--ip-masq", "--kube-subnet-mgr"{% if flannel_interface is defined %}, "--iface={{ flannel_interface }}"{% endif %}{% if flannel_interface_regexp is defined %}, "--iface-regex={{ flannel_interface_regexp }}"{% endif %} ]
  75. securityContext:
  76. privileged: true
  77. env:
  78. - name: POD_NAME
  79. valueFrom:
  80. fieldRef:
  81. fieldPath: metadata.name
  82. - name: POD_NAMESPACE
  83. valueFrom:
  84. fieldRef:
  85. fieldPath: metadata.namespace
  86. - name: POD_IP
  87. valueFrom:
  88. fieldRef:
  89. fieldPath: status.podIP
  90. volumeMounts:
  91. - name: run
  92. mountPath: /run
  93. - name: cni
  94. mountPath: /etc/cni/net.d
  95. - name: flannel-cfg
  96. mountPath: /etc/kube-flannel/
  97. - name: install-cni
  98. image: {{ flannel_cni_image_repo }}:{{ flannel_cni_image_tag }}
  99. command: ["/install-cni.sh"]
  100. env:
  101. # The CNI network config to install on each node.
  102. - name: CNI_NETWORK_CONFIG
  103. valueFrom:
  104. configMapKeyRef:
  105. name: kube-flannel-cfg
  106. key: cni-conf.json
  107. - name: CNI_CONF_NAME
  108. value: "10-flannel.conflist"
  109. volumeMounts:
  110. - name: cni
  111. mountPath: /host/etc/cni/net.d
  112. - name: host-cni-bin
  113. mountPath: /host/opt/cni/bin/
  114. hostNetwork: true
  115. dnsPolicy: ClusterFirstWithHostNet
  116. tolerations:
  117. - operator: Exists
  118. # Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12)
  119. - key: CriticalAddonsOnly
  120. operator: "Exists"
  121. volumes:
  122. - name: run
  123. hostPath:
  124. path: /run
  125. - name: cni
  126. hostPath:
  127. path: /etc/cni/net.d
  128. - name: flannel-cfg
  129. configMap:
  130. name: kube-flannel-cfg
  131. - name: host-cni-bin
  132. hostPath:
  133. path: /opt/cni/bin
  134. updateStrategy:
  135. rollingUpdate:
  136. maxUnavailable: {{ serial | default('20%') }}
  137. type: RollingUpdate