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.

126 lines
3.2 KiB

  1. ---
  2. kind: ConfigMap
  3. apiVersion: v1
  4. metadata:
  5. name: kube-flannel-cfg
  6. namespace: "{{system_namespace}}"
  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: "{{system_namespace}}"
  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 rbac_enabled %}
  56. serviceAccountName: flannel
  57. {% endif %}
  58. containers:
  59. - name: kube-flannel
  60. image: {{ flannel_image_repo }}:{{ flannel_image_tag }}
  61. imagePullPolicy: {{ k8s_image_pull_policy }}
  62. resources:
  63. limits:
  64. cpu: {{ flannel_cpu_limit }}
  65. memory: {{ flannel_memory_limit }}
  66. requests:
  67. cpu: {{ flannel_cpu_requests }}
  68. memory: {{ flannel_memory_requests }}
  69. command: [ "/opt/bin/flanneld", "--ip-masq", "--kube-subnet-mgr"{% if flannel_interface is defined %}, "--iface={{ flannel_interface }}"{% endif %} ]
  70. securityContext:
  71. privileged: true
  72. env:
  73. - name: POD_NAME
  74. valueFrom:
  75. fieldRef:
  76. fieldPath: metadata.name
  77. - name: POD_NAMESPACE
  78. valueFrom:
  79. fieldRef:
  80. fieldPath: metadata.namespace
  81. volumeMounts:
  82. - name: run
  83. mountPath: /run
  84. - name: cni
  85. mountPath: /etc/cni/net.d
  86. - name: flannel-cfg
  87. mountPath: /etc/kube-flannel/
  88. - name: install-cni
  89. image: {{ flannel_cni_image_repo }}:{{ flannel_cni_image_tag }}
  90. command: ["/install-cni.sh"]
  91. env:
  92. # The CNI network config to install on each node.
  93. - name: CNI_NETWORK_CONFIG
  94. valueFrom:
  95. configMapKeyRef:
  96. name: kube-flannel-cfg
  97. key: cni-conf.json
  98. - name: CNI_CONF_NAME
  99. value: "10-flannel.conflist"
  100. volumeMounts:
  101. - name: cni
  102. mountPath: /host/etc/cni/net.d
  103. - name: host-cni-bin
  104. mountPath: /host/opt/cni/bin/
  105. hostNetwork: true
  106. tolerations:
  107. - key: node-role.kubernetes.io/master
  108. operator: Exists
  109. effect: NoSchedule
  110. volumes:
  111. - name: run
  112. hostPath:
  113. path: /run
  114. - name: cni
  115. hostPath:
  116. path: /etc/cni/net.d
  117. - name: flannel-cfg
  118. configMap:
  119. name: kube-flannel-cfg
  120. - name: host-cni-bin
  121. hostPath:
  122. path: /opt/cni/bin
  123. updateStrategy:
  124. rollingUpdate:
  125. maxUnavailable: {{ serial | default('20%') }}
  126. type: RollingUpdate