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.

163 lines
5.0 KiB

  1. ---
  2. apiVersion: extensions/v1beta1
  3. kind: DaemonSet
  4. metadata:
  5. name: cilium
  6. namespace: {{ system_namespace }}
  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. livenessProbe:
  83. exec:
  84. command:
  85. - cilium
  86. - status
  87. # The initial delay for the liveness probe is intentionally large to
  88. # avoid an endless kill & restart cycle if in the event that the initial
  89. # bootstrapping takes longer than expected.
  90. initialDelaySeconds: 120
  91. failureThreshold: 10
  92. periodSeconds: 10
  93. readinessProbe:
  94. exec:
  95. command:
  96. - cilium
  97. - status
  98. initialDelaySeconds: 5
  99. periodSeconds: 5
  100. volumeMounts:
  101. - name: bpf-maps
  102. mountPath: /sys/fs/bpf
  103. - name: cilium-run
  104. mountPath: /var/run/cilium
  105. - name: cni-path
  106. mountPath: /host/opt/cni/bin
  107. - name: etc-cni-netd
  108. mountPath: /host/etc/cni/net.d
  109. - name: docker-socket
  110. mountPath: /var/run/docker.sock
  111. readOnly: true
  112. - name: etcd-config-path
  113. mountPath: /var/lib/etcd-config
  114. readOnly: true
  115. - name: cilium-certs
  116. mountPath: {{ cilium_cert_dir }}
  117. readOnly: true
  118. securityContext:
  119. capabilities:
  120. add:
  121. - "NET_ADMIN"
  122. privileged: true
  123. hostNetwork: true
  124. volumes:
  125. # To keep state between restarts / upgrades
  126. - name: cilium-run
  127. hostPath:
  128. path: /var/run/cilium
  129. # To keep state between restarts / upgrades
  130. - name: bpf-maps
  131. hostPath:
  132. path: /sys/fs/bpf
  133. # To read docker events from the node
  134. - name: docker-socket
  135. hostPath:
  136. path: /var/run/docker.sock
  137. # To install cilium cni plugin in the host
  138. - name: cni-path
  139. hostPath:
  140. path: /opt/cni/bin
  141. # To install cilium cni configuration in the host
  142. - name: etc-cni-netd
  143. hostPath:
  144. path: /etc/cni/net.d
  145. - name: cilium-certs
  146. hostPath:
  147. path: {{ cilium_cert_dir }}
  148. # To read the etcd config stored in config maps
  149. - name: etcd-config-path
  150. configMap:
  151. name: cilium-config
  152. items:
  153. - key: etcd-config
  154. path: etcd.config
  155. tolerations:
  156. - effect: NoSchedule
  157. key: node-role.kubernetes.io/master
  158. - effect: NoSchedule
  159. key: node.cloudprovider.kubernetes.io/uninitialized
  160. value: "true"
  161. # Mark cilium's pod as critical for rescheduling
  162. - key: CriticalAddonsOnly
  163. operator: "Exists"