2018-07-26 20:17:27 +00:00
|
|
|
apiVersion: apps/v1
|
2018-02-17 03:37:47 +00:00
|
|
|
kind: DaemonSet
|
|
|
|
metadata:
|
2019-08-06 08:37:55 +00:00
|
|
|
labels:
|
|
|
|
k8s-app: cilium
|
2018-02-17 03:37:47 +00:00
|
|
|
name: cilium
|
2018-03-30 11:29:13 +00:00
|
|
|
namespace: kube-system
|
2018-02-17 03:37:47 +00:00
|
|
|
spec:
|
2018-07-26 20:17:27 +00:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
k8s-app: cilium
|
2018-02-17 03:37:47 +00:00
|
|
|
template:
|
|
|
|
metadata:
|
2019-08-06 08:37:55 +00:00
|
|
|
annotations:
|
2018-02-17 03:37:47 +00:00
|
|
|
{% if cilium_enable_prometheus %}
|
|
|
|
prometheus.io/port: "9090"
|
2019-08-06 08:37:55 +00:00
|
|
|
prometheus.io/scrape: "true"
|
2018-02-17 03:37:47 +00:00
|
|
|
{% endif %}
|
2019-08-06 08:37:55 +00:00
|
|
|
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"dedicated","operator":"Equal","value":"master","effect":"NoSchedule"}]'
|
|
|
|
labels:
|
|
|
|
k8s-app: cilium
|
2018-02-17 03:37:47 +00:00
|
|
|
spec:
|
|
|
|
containers:
|
2019-08-06 08:37:55 +00:00
|
|
|
- args:
|
|
|
|
- --kvstore=etcd
|
|
|
|
- --kvstore-opt=etcd.config=/var/lib/etcd-config/etcd.config
|
|
|
|
- --config-dir=/tmp/cilium/config-map
|
2020-07-02 14:12:47 +00:00
|
|
|
{% if cilium_mtu != "" %}
|
|
|
|
- --mtu={{ cilium_mtu }}
|
|
|
|
{% endif %}
|
2019-08-06 08:37:55 +00:00
|
|
|
command:
|
|
|
|
- cilium-agent
|
|
|
|
env:
|
|
|
|
- name: K8S_NODE_NAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
apiVersion: v1
|
|
|
|
fieldPath: spec.nodeName
|
|
|
|
- name: CILIUM_K8S_NAMESPACE
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
apiVersion: v1
|
|
|
|
fieldPath: metadata.namespace
|
|
|
|
- name: CILIUM_CLUSTERMESH_CONFIG
|
|
|
|
value: /var/lib/cilium/clustermesh/
|
2020-08-06 07:14:55 +00:00
|
|
|
{% if cilium_kube_proxy_replacement == 'strict' %}
|
|
|
|
- name: KUBERNETES_SERVICE_HOST
|
|
|
|
value: "{{ kube_apiserver_global_endpoint | urlsplit('hostname') }}"
|
|
|
|
- name: KUBERNETES_SERVICE_PORT
|
|
|
|
value: "{{ kube_apiserver_global_endpoint | urlsplit('port') }}"
|
|
|
|
{% endif %}
|
2019-08-06 08:37:55 +00:00
|
|
|
image: "{{cilium_image_repo}}:{{cilium_image_tag}}"
|
2020-05-10 18:37:50 +00:00
|
|
|
imagePullPolicy: {{ k8s_image_pull_policy }}
|
2019-08-06 08:37:55 +00:00
|
|
|
resources:
|
|
|
|
limits:
|
|
|
|
cpu: {{ cilium_cpu_limit }}
|
|
|
|
memory: {{ cilium_memory_limit }}
|
|
|
|
requests:
|
|
|
|
cpu: {{ cilium_cpu_requests }}
|
|
|
|
memory: {{ cilium_memory_requests }}
|
|
|
|
lifecycle:
|
|
|
|
postStart:
|
2018-02-17 03:37:47 +00:00
|
|
|
exec:
|
|
|
|
command:
|
2019-08-06 08:37:55 +00:00
|
|
|
- /cni-install.sh
|
|
|
|
preStop:
|
2018-02-17 03:37:47 +00:00
|
|
|
exec:
|
|
|
|
command:
|
2019-08-06 08:37:55 +00:00
|
|
|
- /cni-uninstall.sh
|
|
|
|
livenessProbe:
|
2020-06-25 13:16:38 +00:00
|
|
|
httpGet:
|
|
|
|
host: '127.0.0.1'
|
|
|
|
path: /healthz
|
|
|
|
port: 9876
|
|
|
|
scheme: HTTP
|
|
|
|
httpHeaders:
|
|
|
|
- name: "brief"
|
|
|
|
value: "true"
|
2019-08-06 08:37:55 +00:00
|
|
|
failureThreshold: 10
|
|
|
|
# The initial delay for the liveness probe is intentionally large to
|
|
|
|
# avoid an endless kill & restart cycle if in the event that the initial
|
|
|
|
# bootstrapping takes longer than expected.
|
|
|
|
initialDelaySeconds: 120
|
|
|
|
periodSeconds: 30
|
|
|
|
successThreshold: 1
|
|
|
|
timeoutSeconds: 5
|
|
|
|
name: cilium-agent
|
|
|
|
{% if cilium_enable_prometheus %}
|
|
|
|
ports:
|
|
|
|
- containerPort: 9090
|
|
|
|
hostPort: 9090
|
|
|
|
name: prometheus
|
|
|
|
protocol: TCP
|
|
|
|
{% endif %}
|
|
|
|
readinessProbe:
|
2020-06-25 13:16:38 +00:00
|
|
|
httpGet:
|
|
|
|
host: '127.0.0.1'
|
|
|
|
path: /healthz
|
|
|
|
port: 9876
|
|
|
|
scheme: HTTP
|
|
|
|
httpHeaders:
|
|
|
|
- name: "brief"
|
|
|
|
value: "true"
|
2019-08-06 08:37:55 +00:00
|
|
|
failureThreshold: 3
|
|
|
|
initialDelaySeconds: 5
|
|
|
|
periodSeconds: 30
|
|
|
|
successThreshold: 1
|
|
|
|
timeoutSeconds: 5
|
|
|
|
securityContext:
|
|
|
|
capabilities:
|
|
|
|
add:
|
|
|
|
- NET_ADMIN
|
|
|
|
- SYS_MODULE
|
|
|
|
privileged: true
|
|
|
|
volumeMounts:
|
|
|
|
- mountPath: /sys/fs/bpf
|
|
|
|
name: bpf-maps
|
|
|
|
- mountPath: /var/run/cilium
|
|
|
|
name: cilium-run
|
|
|
|
- mountPath: /host/opt/cni/bin
|
|
|
|
name: cni-path
|
|
|
|
- mountPath: /host/etc/cni/net.d
|
|
|
|
name: etc-cni-netd
|
2019-06-29 21:09:20 +00:00
|
|
|
{% if container_manager == 'docker' %}
|
2019-08-06 08:37:55 +00:00
|
|
|
- mountPath: /var/run/docker.sock
|
|
|
|
name: docker-socket
|
|
|
|
readOnly: true
|
2019-06-29 21:09:20 +00:00
|
|
|
{% else %}
|
2019-11-11 11:25:41 +00:00
|
|
|
- name: "{{ container_manager }}-socket"
|
|
|
|
mountPath: {{ cri_socket }}
|
|
|
|
readOnly: true
|
2018-09-12 15:35:28 +00:00
|
|
|
{% endif %}
|
2019-08-06 08:37:55 +00:00
|
|
|
- mountPath: /var/lib/etcd-config
|
|
|
|
name: etcd-config-path
|
|
|
|
readOnly: true
|
|
|
|
- mountPath: "{{cilium_cert_dir}}"
|
|
|
|
name: etcd-secrets
|
|
|
|
readOnly: true
|
|
|
|
- mountPath: /var/lib/cilium/clustermesh
|
|
|
|
name: clustermesh-secrets
|
|
|
|
readOnly: true
|
|
|
|
- mountPath: /tmp/cilium/config-map
|
|
|
|
name: cilium-config-path
|
|
|
|
readOnly: true
|
|
|
|
# Needed to be able to load kernel modules
|
|
|
|
- mountPath: /lib/modules
|
|
|
|
name: lib-modules
|
|
|
|
readOnly: true
|
2020-06-25 13:16:38 +00:00
|
|
|
- mountPath: /run/xtables.lock
|
|
|
|
name: xtables-lock
|
2019-06-05 10:17:56 +00:00
|
|
|
dnsPolicy: ClusterFirstWithHostNet
|
2019-08-06 08:37:55 +00:00
|
|
|
hostNetwork: true
|
|
|
|
hostPID: false
|
|
|
|
initContainers:
|
|
|
|
- command:
|
|
|
|
- /init-container.sh
|
|
|
|
env:
|
2020-06-25 13:16:38 +00:00
|
|
|
- name: CILIUM_ALL_STATE
|
2019-08-06 08:37:55 +00:00
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
key: clean-cilium-state
|
|
|
|
name: cilium-config
|
|
|
|
optional: true
|
|
|
|
- name: CLEAN_CILIUM_BPF_STATE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
key: clean-cilium-bpf-state
|
|
|
|
name: cilium-config
|
|
|
|
optional: true
|
|
|
|
- name: CILIUM_WAIT_BPF_MOUNT
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
key: wait-bpf-mount
|
|
|
|
name: cilium-config
|
|
|
|
optional: true
|
|
|
|
image: "{{cilium_init_image_repo}}:{{cilium_init_image_tag}}"
|
2020-05-10 18:37:50 +00:00
|
|
|
imagePullPolicy: {{ k8s_image_pull_policy }}
|
2019-08-06 08:37:55 +00:00
|
|
|
name: clean-cilium-state
|
|
|
|
securityContext:
|
|
|
|
capabilities:
|
|
|
|
add:
|
|
|
|
- NET_ADMIN
|
|
|
|
privileged: true
|
|
|
|
volumeMounts:
|
|
|
|
- mountPath: /sys/fs/bpf
|
|
|
|
name: bpf-maps
|
|
|
|
- mountPath: /var/run/cilium
|
|
|
|
name: cilium-run
|
|
|
|
priorityClassName: system-node-critical
|
|
|
|
restartPolicy: Always
|
|
|
|
serviceAccount: cilium
|
|
|
|
serviceAccountName: cilium
|
|
|
|
terminationGracePeriodSeconds: 1
|
|
|
|
tolerations:
|
|
|
|
- operator: Exists
|
2018-02-17 03:37:47 +00:00
|
|
|
volumes:
|
2018-07-26 20:17:27 +00:00
|
|
|
# To keep state between restarts / upgrades
|
2019-08-06 08:37:55 +00:00
|
|
|
- hostPath:
|
|
|
|
path: /var/run/cilium
|
|
|
|
type: DirectoryOrCreate
|
|
|
|
name: cilium-run
|
|
|
|
# To keep state between restarts / upgrades for bpf maps
|
|
|
|
- hostPath:
|
|
|
|
path: /sys/fs/bpf
|
|
|
|
type: DirectoryOrCreate
|
|
|
|
name: bpf-maps
|
2019-06-29 21:09:20 +00:00
|
|
|
{% if container_manager == 'docker' %}
|
2018-07-26 20:17:27 +00:00
|
|
|
# To read docker events from the node
|
2019-08-06 08:37:55 +00:00
|
|
|
- hostPath:
|
|
|
|
path: /var/run/docker.sock
|
|
|
|
type: Socket
|
|
|
|
name: docker-socket
|
2019-06-29 21:09:20 +00:00
|
|
|
{% else %}
|
|
|
|
# To read crio events from the node
|
2019-08-06 08:37:55 +00:00
|
|
|
- hostPath:
|
|
|
|
path: {{ cri_socket }}
|
|
|
|
type: Socket
|
|
|
|
name: {{ container_manager }}-socket
|
2018-09-12 15:35:28 +00:00
|
|
|
{% endif %}
|
2018-07-26 20:17:27 +00:00
|
|
|
# To install cilium cni plugin in the host
|
2019-08-06 08:37:55 +00:00
|
|
|
- hostPath:
|
|
|
|
path: /opt/cni/bin
|
|
|
|
type: DirectoryOrCreate
|
|
|
|
name: cni-path
|
2018-07-26 20:17:27 +00:00
|
|
|
# To install cilium cni configuration in the host
|
2019-08-06 08:37:55 +00:00
|
|
|
- hostPath:
|
|
|
|
path: /etc/cni/net.d
|
|
|
|
type: DirectoryOrCreate
|
|
|
|
name: etc-cni-netd
|
|
|
|
# To be able to load kernel modules
|
|
|
|
- hostPath:
|
|
|
|
path: /lib/modules
|
|
|
|
name: lib-modules
|
2020-06-25 13:16:38 +00:00
|
|
|
# To access iptables concurrently with other processes (e.g. kube-proxy)
|
|
|
|
- hostPath:
|
|
|
|
path: /run/xtables.lock
|
|
|
|
type: FileOrCreate
|
|
|
|
name: xtables-lock
|
2018-07-26 20:17:27 +00:00
|
|
|
# To read the etcd config stored in config maps
|
2019-08-06 08:37:55 +00:00
|
|
|
- configMap:
|
|
|
|
defaultMode: 420
|
|
|
|
items:
|
|
|
|
- key: etcd-config
|
|
|
|
path: etcd.config
|
|
|
|
name: cilium-config
|
|
|
|
name: etcd-config-path
|
2018-07-26 20:17:27 +00:00
|
|
|
# To read the k8s etcd secrets in case the user might want to use TLS
|
2019-08-06 08:37:55 +00:00
|
|
|
- name: etcd-secrets
|
|
|
|
hostPath:
|
|
|
|
path: "{{cilium_cert_dir}}"
|
|
|
|
# To read the clustermesh configuration
|
|
|
|
- name: clustermesh-secrets
|
|
|
|
secret:
|
|
|
|
defaultMode: 420
|
|
|
|
optional: true
|
|
|
|
secretName: cilium-clustermesh
|
|
|
|
# To read the configuration from the config map
|
|
|
|
- configMap:
|
|
|
|
name: cilium-config
|
|
|
|
name: cilium-config-path
|
|
|
|
updateStrategy:
|
|
|
|
rollingUpdate:
|
|
|
|
# Specifies the maximum number of Pods that can be unavailable during the update process.
|
|
|
|
maxUnavailable: 2
|
|
|
|
type: RollingUpdate
|