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.

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