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.

160 lines
5.3 KiB

  1. ---
  2. kind: DaemonSet
  3. apiVersion: extensions/v1beta1
  4. metadata:
  5. name: canal-node
  6. labels:
  7. k8s-app: canal-node
  8. spec:
  9. selector:
  10. matchLabels:
  11. k8s-app: canal-node
  12. template:
  13. metadata:
  14. annotations:
  15. scheduler.alpha.kubernetes.io/critical-pod: ''
  16. scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
  17. labels:
  18. k8s-app: canal-node
  19. spec:
  20. hostNetwork: true
  21. volumes:
  22. # Used by calico/node.
  23. - name: lib-modules
  24. hostPath:
  25. path: /lib/modules
  26. - name: var-run-calico
  27. hostPath:
  28. path: /var/run/calico
  29. # Used to install CNI.
  30. - name: cni-bin-dir
  31. hostPath:
  32. path: /opt/cni/bin
  33. - name: cni-net-dir
  34. hostPath:
  35. path: /etc/cni/net.d
  36. # Used by flannel daemon.
  37. - name: run-flannel
  38. hostPath:
  39. path: /run/flannel
  40. - name: resolv
  41. hostPath:
  42. path: /etc/resolv.conf
  43. - name: "canal-certs"
  44. hostPath:
  45. path: "{{ canal_cert_dir }}"
  46. containers:
  47. # Runs the flannel daemon to enable vxlan networking between
  48. # container hosts.
  49. - name: flannel
  50. image: "{{ flannel_image_repo }}:{{ flannel_image_tag }}"
  51. env:
  52. # Cluster name
  53. - name: CLUSTER_NAME
  54. valueFrom:
  55. configMapKeyRef:
  56. name: canal-config
  57. key: cluster_name
  58. # The location of the etcd cluster.
  59. - name: FLANNELD_ETCD_ENDPOINTS
  60. valueFrom:
  61. configMapKeyRef:
  62. name: canal-config
  63. key: etcd_endpoints
  64. # The interface flannel should run on.
  65. - name: FLANNELD_IFACE
  66. valueFrom:
  67. configMapKeyRef:
  68. name: canal-config
  69. key: flanneld_iface
  70. # Perform masquerade on traffic leaving the pod cidr.
  71. - name: FLANNELD_IP_MASQ
  72. valueFrom:
  73. configMapKeyRef:
  74. name: canal-config
  75. key: masquerade
  76. # Set etcd-prefix
  77. - name: DOCKER_OPT_ETCD_PREFIX
  78. value: "-etcd-prefix=/$(CLUSTER_NAME)/network"
  79. # Write the subnet.env file to the mounted directory.
  80. - name: FLANNELD_SUBNET_FILE
  81. value: "/run/flannel/subnet.env"
  82. # Etcd SSL vars
  83. - name: ETCD_CA_CERT_FILE
  84. valueFrom:
  85. configMapKeyRef:
  86. name: canal-config
  87. key: etcd_cafile
  88. - name: ETCD_CERT_FILE
  89. valueFrom:
  90. configMapKeyRef:
  91. name: canal-config
  92. key: etcd_certfile
  93. - name: ETCD_KEY_FILE
  94. valueFrom:
  95. configMapKeyRef:
  96. name: canal-config
  97. key: etcd_keyfile
  98. command:
  99. - "/bin/sh"
  100. - "-c"
  101. - "/opt/bin/flanneld -etcd-prefix /$(CLUSTER_NAME)/network -etcd-cafile $(ETCD_CA_CERT_FILE) -etcd-certfile $(ETCD_CERT_FILE) -etcd-keyfile $(ETCD_KEY_FILE)"
  102. ports:
  103. - hostPort: 10253
  104. containerPort: 10253
  105. securityContext:
  106. privileged: true
  107. volumeMounts:
  108. - name: "resolv"
  109. mountPath: "/etc/resolv.conf"
  110. - name: "run-flannel"
  111. mountPath: "/run/flannel"
  112. - name: "canal-certs"
  113. mountPath: "{{ canal_cert_dir }}"
  114. readOnly: true
  115. # Runs calico/node container on each Kubernetes node. This
  116. # container programs network policy and local routes on each
  117. # host.
  118. - name: calico-node
  119. image: "{{ calico_node_image_repo }}:{{ calico_node_image_tag }}"
  120. env:
  121. # The location of the etcd cluster.
  122. - name: ETCD_ENDPOINTS
  123. valueFrom:
  124. configMapKeyRef:
  125. name: canal-config
  126. key: etcd_endpoints
  127. # Disable Calico BGP. Calico is simply enforcing policy.
  128. - name: CALICO_NETWORKING
  129. value: "false"
  130. # Disable file logging so `kubectl logs` works.
  131. - name: CALICO_DISABLE_FILE_LOGGING
  132. value: "true"
  133. # Etcd SSL vars
  134. - name: ETCD_CA_CERT_FILE
  135. valueFrom:
  136. configMapKeyRef:
  137. name: canal-config
  138. key: etcd_cafile
  139. - name: ETCD_CERT_FILE
  140. valueFrom:
  141. configMapKeyRef:
  142. name: canal-config
  143. key: etcd_certfile
  144. - name: ETCD_KEY_FILE
  145. valueFrom:
  146. configMapKeyRef:
  147. name: canal-config
  148. key: etcd_keyfile
  149. securityContext:
  150. privileged: true
  151. volumeMounts:
  152. - mountPath: /lib/modules
  153. name: lib-modules
  154. readOnly: true
  155. - mountPath: /var/run/calico
  156. name: var-run-calico
  157. readOnly: false
  158. - name: "canal-certs"
  159. mountPath: "{{ canal_cert_dir }}"
  160. readOnly: true