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.

127 lines
3.4 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. serviceAccountName: flannel
  56. # When having win nodes in cluster without this patch, this pod cloud try to be created in windows
  57. nodeSelector:
  58. beta.kubernetes.io/os: linux
  59. containers:
  60. - name: kube-flannel
  61. image: {{ flannel_image_repo }}:{{ flannel_image_tag }}
  62. imagePullPolicy: {{ k8s_image_pull_policy }}
  63. resources:
  64. limits:
  65. cpu: {{ flannel_cpu_limit }}
  66. memory: {{ flannel_memory_limit }}
  67. requests:
  68. cpu: {{ flannel_cpu_requests }}
  69. memory: {{ flannel_memory_requests }}
  70. 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 %} ]
  71. securityContext:
  72. privileged: true
  73. env:
  74. - name: POD_NAME
  75. valueFrom:
  76. fieldRef:
  77. fieldPath: metadata.name
  78. - name: POD_NAMESPACE
  79. valueFrom:
  80. fieldRef:
  81. fieldPath: metadata.namespace
  82. volumeMounts:
  83. - name: run
  84. mountPath: /run
  85. - name: cni
  86. mountPath: /etc/cni/net.d
  87. - name: flannel-cfg
  88. mountPath: /etc/kube-flannel/
  89. - name: install-cni
  90. image: {{ flannel_cni_image_repo }}:{{ flannel_cni_image_tag }}
  91. command: ["/install-cni.sh"]
  92. env:
  93. # The CNI network config to install on each node.
  94. - name: CNI_NETWORK_CONFIG
  95. valueFrom:
  96. configMapKeyRef:
  97. name: kube-flannel-cfg
  98. key: cni-conf.json
  99. - name: CNI_CONF_NAME
  100. value: "10-flannel.conflist"
  101. volumeMounts:
  102. - name: cni
  103. mountPath: /host/etc/cni/net.d
  104. - name: host-cni-bin
  105. mountPath: /host/opt/cni/bin/
  106. hostNetwork: true
  107. tolerations:
  108. - key: node-role.kubernetes.io/master
  109. operator: Exists
  110. effect: NoSchedule
  111. volumes:
  112. - name: run
  113. hostPath:
  114. path: /run
  115. - name: cni
  116. hostPath:
  117. path: /etc/cni/net.d
  118. - name: flannel-cfg
  119. configMap:
  120. name: kube-flannel-cfg
  121. - name: host-cni-bin
  122. hostPath:
  123. path: /opt/cni/bin
  124. updateStrategy:
  125. rollingUpdate:
  126. maxUnavailable: {{ serial | default('20%') }}
  127. type: RollingUpdate