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.

170 lines
5.3 KiB

  1. ---
  2. apiVersion: extensions/v1beta1
  3. kind: DaemonSet
  4. metadata:
  5. name: cilium
  6. namespace: kube-system
  7. spec:
  8. template:
  9. metadata:
  10. labels:
  11. k8s-app: cilium
  12. kubernetes.io/cluster-service: "true"
  13. annotations:
  14. # This annotation plus the CriticalAddonsOnly toleration makes
  15. # cilium to be a critical pod in the cluster, which ensures cilium
  16. # gets priority scheduling.
  17. # https://kubernetes.io/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/
  18. scheduler.alpha.kubernetes.io/critical-pod: ''
  19. scheduler.alpha.kubernetes.io/tolerations: >-
  20. [{"key":"dedicated","operator":"Equal","value":"master","effect":"NoSchedule"}]
  21. {% if cilium_enable_prometheus %}
  22. prometheus.io/scrape: "true"
  23. prometheus.io/port: "9090"
  24. {% endif %}
  25. spec:
  26. {% if rbac_enabled %}
  27. serviceAccountName: cilium
  28. {% endif %}
  29. containers:
  30. - image: {{ cilium_image_repo }}:{{ cilium_image_tag }}
  31. imagePullPolicy: Always
  32. name: cilium-agent
  33. command: [ "cilium-agent" ]
  34. args:
  35. - "--debug=$(CILIUM_DEBUG)"
  36. - "-t"
  37. - "vxlan"
  38. - "--kvstore"
  39. - "etcd"
  40. - "--kvstore-opt"
  41. - "etcd.config=/var/lib/etcd-config/etcd.config"
  42. - "--disable-ipv4=$(DISABLE_IPV4)"
  43. {% if cilium_enable_prometheus %}
  44. ports:
  45. - name: prometheus
  46. containerPort: 9090
  47. {% endif %}
  48. lifecycle:
  49. postStart:
  50. exec:
  51. command:
  52. - "/cni-install.sh"
  53. preStop:
  54. exec:
  55. command:
  56. - "/cni-uninstall.sh"
  57. env:
  58. - name: "K8S_NODE_NAME"
  59. valueFrom:
  60. fieldRef:
  61. fieldPath: spec.nodeName
  62. - name: "CILIUM_DEBUG"
  63. valueFrom:
  64. configMapKeyRef:
  65. name: cilium-config
  66. key: debug
  67. - name: "DISABLE_IPV4"
  68. valueFrom:
  69. configMapKeyRef:
  70. name: cilium-config
  71. key: disable-ipv4
  72. {% if cilium_enable_prometheus %}
  73. # Note: this variable is a no-op if not defined, and is used in the
  74. # prometheus examples.
  75. - name: "CILIUM_PROMETHEUS_SERVE_ADDR"
  76. valueFrom:
  77. configMapKeyRef:
  78. name: cilium-metrics-config
  79. optional: true
  80. key: prometheus-serve-addr
  81. {% endif %}
  82. resources:
  83. limits:
  84. cpu: {{ cilium_cpu_limit }}
  85. memory: {{ cilium_memory_limit }}
  86. requests:
  87. cpu: {{ cilium_cpu_requests }}
  88. memory: {{ cilium_memory_requests }}
  89. livenessProbe:
  90. exec:
  91. command:
  92. - cilium
  93. - status
  94. # The initial delay for the liveness probe is intentionally large to
  95. # avoid an endless kill & restart cycle if in the event that the initial
  96. # bootstrapping takes longer than expected.
  97. initialDelaySeconds: 120
  98. failureThreshold: 10
  99. periodSeconds: 10
  100. readinessProbe:
  101. exec:
  102. command:
  103. - cilium
  104. - status
  105. initialDelaySeconds: 5
  106. periodSeconds: 5
  107. volumeMounts:
  108. - name: bpf-maps
  109. mountPath: /sys/fs/bpf
  110. - name: cilium-run
  111. mountPath: /var/run/cilium
  112. - name: cni-path
  113. mountPath: /host/opt/cni/bin
  114. - name: etc-cni-netd
  115. mountPath: /host/etc/cni/net.d
  116. - name: docker-socket
  117. mountPath: /var/run/docker.sock
  118. readOnly: true
  119. - name: etcd-config-path
  120. mountPath: /var/lib/etcd-config
  121. readOnly: true
  122. - name: cilium-certs
  123. mountPath: {{ cilium_cert_dir }}
  124. readOnly: true
  125. securityContext:
  126. capabilities:
  127. add:
  128. - "NET_ADMIN"
  129. privileged: true
  130. hostNetwork: true
  131. volumes:
  132. # To keep state between restarts / upgrades
  133. - name: cilium-run
  134. hostPath:
  135. path: /var/run/cilium
  136. # To keep state between restarts / upgrades
  137. - name: bpf-maps
  138. hostPath:
  139. path: /sys/fs/bpf
  140. # To read docker events from the node
  141. - name: docker-socket
  142. hostPath:
  143. path: /var/run/docker.sock
  144. # To install cilium cni plugin in the host
  145. - name: cni-path
  146. hostPath:
  147. path: /opt/cni/bin
  148. # To install cilium cni configuration in the host
  149. - name: etc-cni-netd
  150. hostPath:
  151. path: /etc/cni/net.d
  152. - name: cilium-certs
  153. hostPath:
  154. path: {{ cilium_cert_dir }}
  155. # To read the etcd config stored in config maps
  156. - name: etcd-config-path
  157. configMap:
  158. name: cilium-config
  159. items:
  160. - key: etcd-config
  161. path: etcd.config
  162. tolerations:
  163. - effect: NoSchedule
  164. key: node-role.kubernetes.io/master
  165. - effect: NoSchedule
  166. key: node.cloudprovider.kubernetes.io/uninitialized
  167. value: "true"
  168. # Mark cilium's pod as critical for rescheduling
  169. - key: CriticalAddonsOnly
  170. operator: "Exists"