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.

138 lines
3.8 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: extensions/v1beta1
  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. template:
  50. metadata:
  51. labels:
  52. tier: node
  53. k8s-app: flannel
  54. annotations:
  55. # Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12)
  56. scheduler.alpha.kubernetes.io/critical-pod: ''
  57. spec:
  58. {% if kube_version is version('v1.11.1', '>=') %}
  59. priorityClassName: system-node-critical
  60. {% endif %}
  61. serviceAccountName: flannel
  62. # When having win nodes in cluster without this patch, this pod cloud try to be created in windows
  63. nodeSelector:
  64. beta.kubernetes.io/os: linux
  65. containers:
  66. - name: kube-flannel
  67. image: {{ flannel_image_repo }}:{{ flannel_image_tag }}
  68. imagePullPolicy: {{ k8s_image_pull_policy }}
  69. resources:
  70. limits:
  71. cpu: {{ flannel_cpu_limit }}
  72. memory: {{ flannel_memory_limit }}
  73. requests:
  74. cpu: {{ flannel_cpu_requests }}
  75. memory: {{ flannel_memory_requests }}
  76. 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 %} ]
  77. securityContext:
  78. privileged: true
  79. env:
  80. - name: POD_NAME
  81. valueFrom:
  82. fieldRef:
  83. fieldPath: metadata.name
  84. - name: POD_NAMESPACE
  85. valueFrom:
  86. fieldRef:
  87. fieldPath: metadata.namespace
  88. - name: POD_IP
  89. valueFrom:
  90. fieldRef:
  91. fieldPath: status.podIP
  92. volumeMounts:
  93. - name: run
  94. mountPath: /run
  95. - name: cni
  96. mountPath: /etc/cni/net.d
  97. - name: flannel-cfg
  98. mountPath: /etc/kube-flannel/
  99. - name: install-cni
  100. image: {{ flannel_cni_image_repo }}:{{ flannel_cni_image_tag }}
  101. command: ["/install-cni.sh"]
  102. env:
  103. # The CNI network config to install on each node.
  104. - name: CNI_NETWORK_CONFIG
  105. valueFrom:
  106. configMapKeyRef:
  107. name: kube-flannel-cfg
  108. key: cni-conf.json
  109. - name: CNI_CONF_NAME
  110. value: "10-flannel.conflist"
  111. volumeMounts:
  112. - name: cni
  113. mountPath: /host/etc/cni/net.d
  114. - name: host-cni-bin
  115. mountPath: /host/opt/cni/bin/
  116. hostNetwork: true
  117. tolerations:
  118. - operator: Exists
  119. # Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12)
  120. - key: CriticalAddonsOnly
  121. operator: "Exists"
  122. volumes:
  123. - name: run
  124. hostPath:
  125. path: /run
  126. - name: cni
  127. hostPath:
  128. path: /etc/cni/net.d
  129. - name: flannel-cfg
  130. configMap:
  131. name: kube-flannel-cfg
  132. - name: host-cni-bin
  133. hostPath:
  134. path: /opt/cni/bin
  135. updateStrategy:
  136. rollingUpdate:
  137. maxUnavailable: {{ serial | default('20%') }}
  138. type: RollingUpdate