2018-02-17 03:37:47 +00:00
|
|
|
---
|
2018-07-26 20:17:27 +00:00
|
|
|
apiVersion: apps/v1
|
2018-02-17 03:37:47 +00:00
|
|
|
kind: DaemonSet
|
|
|
|
metadata:
|
|
|
|
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
|
|
|
updateStrategy:
|
|
|
|
type: "RollingUpdate"
|
|
|
|
rollingUpdate:
|
|
|
|
# Specifies the maximum number of Pods that can be unavailable during the update process.
|
|
|
|
# The current default value is 1 or 100% for daemonsets; Adding an explicit value here
|
|
|
|
# to avoid confusion, as the default value is specific to the type (daemonset/deployment).
|
|
|
|
maxUnavailable: "100%"
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
k8s-app: cilium
|
|
|
|
kubernetes.io/cluster-service: "true"
|
2018-02-17 03:37:47 +00:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
k8s-app: cilium
|
|
|
|
kubernetes.io/cluster-service: "true"
|
|
|
|
annotations:
|
|
|
|
# This annotation plus the CriticalAddonsOnly toleration makes
|
|
|
|
# cilium to be a critical pod in the cluster, which ensures cilium
|
|
|
|
# gets priority scheduling.
|
|
|
|
# https://kubernetes.io/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/
|
|
|
|
scheduler.alpha.kubernetes.io/critical-pod: ''
|
|
|
|
scheduler.alpha.kubernetes.io/tolerations: >-
|
|
|
|
[{"key":"dedicated","operator":"Equal","value":"master","effect":"NoSchedule"}]
|
|
|
|
{% if cilium_enable_prometheus %}
|
|
|
|
prometheus.io/scrape: "true"
|
|
|
|
prometheus.io/port: "9090"
|
|
|
|
{% endif %}
|
|
|
|
spec:
|
2018-09-25 14:50:22 +00:00
|
|
|
{% if kube_version|version_compare('v1.11.1', '>=') %}
|
|
|
|
priorityClassName: system-node-critical
|
|
|
|
{% endif %}
|
2018-02-17 03:37:47 +00:00
|
|
|
serviceAccountName: cilium
|
2018-07-26 20:17:27 +00:00
|
|
|
initContainers:
|
|
|
|
- name: clean-cilium-state
|
|
|
|
image: docker.io/library/busybox:1.28.4
|
|
|
|
imagePullPolicy: IfNotPresent
|
|
|
|
command: ['sh', '-c', 'if [ "${CLEAN_CILIUM_STATE}" = "true" ]; then rm -rf /var/run/cilium/state; rm -rf /sys/fs/bpf/tc/globals/cilium_*; fi']
|
|
|
|
volumeMounts:
|
|
|
|
- name: bpf-maps
|
|
|
|
mountPath: /sys/fs/bpf
|
|
|
|
- name: cilium-run
|
|
|
|
mountPath: /var/run/cilium
|
|
|
|
env:
|
|
|
|
- name: "CLEAN_CILIUM_STATE"
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: cilium-config
|
|
|
|
optional: true
|
|
|
|
key: clean-cilium-state
|
2018-02-17 03:37:47 +00:00
|
|
|
containers:
|
2018-07-26 20:17:27 +00:00
|
|
|
- image: {{ cilium_image_repo }}:{{ cilium_image_tag }}
|
|
|
|
imagePullPolicy: Always
|
|
|
|
name: cilium-agent
|
|
|
|
command: ["cilium-agent"]
|
|
|
|
args:
|
|
|
|
- "--debug=$(CILIUM_DEBUG)"
|
|
|
|
- "--kvstore=etcd"
|
|
|
|
- "--kvstore-opt=etcd.config=/var/lib/etcd-config/etcd.config"
|
|
|
|
- "--disable-ipv4=$(DISABLE_IPV4)"
|
2018-02-17 03:37:47 +00:00
|
|
|
{% if cilium_enable_prometheus %}
|
2018-07-26 20:17:27 +00:00
|
|
|
ports:
|
|
|
|
- name: prometheus
|
|
|
|
containerPort: 9090
|
2018-02-17 03:37:47 +00:00
|
|
|
{% endif %}
|
2018-07-26 20:17:27 +00:00
|
|
|
lifecycle:
|
|
|
|
postStart:
|
|
|
|
exec:
|
|
|
|
command:
|
|
|
|
- "/cni-install.sh"
|
|
|
|
preStop:
|
|
|
|
exec:
|
|
|
|
command:
|
|
|
|
- "/cni-uninstall.sh"
|
|
|
|
env:
|
|
|
|
- name: "K8S_NODE_NAME"
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: spec.nodeName
|
|
|
|
- name: "CILIUM_DEBUG"
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: cilium-config
|
|
|
|
key: debug
|
|
|
|
- name: "DISABLE_IPV4"
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: cilium-config
|
|
|
|
key: disable-ipv4
|
|
|
|
{% if cilium_enable_prometheus %}
|
|
|
|
# Note: this variable is a no-op if not defined, and is used in the
|
|
|
|
# prometheus examples.
|
|
|
|
- name: "CILIUM_PROMETHEUS_SERVE_ADDR"
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: cilium-metrics-config
|
|
|
|
optional: true
|
|
|
|
key: prometheus-serve-addr
|
|
|
|
{% endif %}
|
|
|
|
- name: "CILIUM_LEGACY_HOST_ALLOWS_WORLD"
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: cilium-config
|
|
|
|
optional: true
|
|
|
|
key: legacy-host-allows-world
|
|
|
|
- name: "CILIUM_SIDECAR_ISTIO_PROXY_IMAGE"
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: cilium-config
|
|
|
|
key: sidecar-istio-proxy-image
|
|
|
|
optional: true
|
|
|
|
- name: "CILIUM_TUNNEL"
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
key: tunnel
|
|
|
|
name: cilium-config
|
|
|
|
optional: true
|
|
|
|
- name: "CILIUM_MONITOR_AGGREGATION_LEVEL"
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
key: monitor-aggregation-level
|
|
|
|
name: cilium-config
|
|
|
|
optional: true
|
|
|
|
resources:
|
|
|
|
limits:
|
|
|
|
cpu: {{ cilium_cpu_limit }}
|
|
|
|
memory: {{ cilium_memory_limit }}
|
|
|
|
requests:
|
|
|
|
cpu: {{ cilium_cpu_requests }}
|
|
|
|
memory: {{ cilium_memory_requests }}
|
|
|
|
livenessProbe:
|
2018-02-17 03:37:47 +00:00
|
|
|
exec:
|
|
|
|
command:
|
2018-07-26 20:17:27 +00:00
|
|
|
- cilium
|
|
|
|
- status
|
|
|
|
# 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
|
|
|
|
failureThreshold: 10
|
|
|
|
periodSeconds: 10
|
|
|
|
readinessProbe:
|
2018-02-17 03:37:47 +00:00
|
|
|
exec:
|
|
|
|
command:
|
2018-07-26 20:17:27 +00:00
|
|
|
- cilium
|
|
|
|
- status
|
|
|
|
initialDelaySeconds: 5
|
|
|
|
periodSeconds: 5
|
|
|
|
volumeMounts:
|
|
|
|
- name: bpf-maps
|
|
|
|
mountPath: /sys/fs/bpf
|
|
|
|
- name: cilium-run
|
|
|
|
mountPath: /var/run/cilium
|
|
|
|
- name: cni-path
|
|
|
|
mountPath: /host/opt/cni/bin
|
|
|
|
- name: etc-cni-netd
|
|
|
|
mountPath: /host/etc/cni/net.d
|
2018-09-12 15:35:28 +00:00
|
|
|
{% if container_manager == 'crio' %}
|
|
|
|
- name: crio-socket
|
|
|
|
mountPath: /var/run/crio.sock
|
|
|
|
readOnly: true
|
|
|
|
{% else %}
|
2018-07-26 20:17:27 +00:00
|
|
|
- name: docker-socket
|
|
|
|
mountPath: /var/run/docker.sock
|
|
|
|
readOnly: true
|
2018-09-12 15:35:28 +00:00
|
|
|
{% endif %}
|
2018-07-26 20:17:27 +00:00
|
|
|
- name: etcd-config-path
|
|
|
|
mountPath: /var/lib/etcd-config
|
|
|
|
readOnly: true
|
|
|
|
- name: cilium-certs
|
|
|
|
mountPath: {{ cilium_cert_dir }}
|
|
|
|
readOnly: true
|
|
|
|
securityContext:
|
|
|
|
capabilities:
|
|
|
|
add:
|
|
|
|
- "NET_ADMIN"
|
|
|
|
privileged: true
|
2018-02-17 03:37:47 +00:00
|
|
|
hostNetwork: true
|
|
|
|
volumes:
|
2018-07-26 20:17:27 +00:00
|
|
|
# To keep state between restarts / upgrades
|
2018-02-17 03:37:47 +00:00
|
|
|
- name: cilium-run
|
|
|
|
hostPath:
|
|
|
|
path: /var/run/cilium
|
2018-07-26 20:17:27 +00:00
|
|
|
# To keep state between restarts / upgrades
|
2018-02-17 03:37:47 +00:00
|
|
|
- name: bpf-maps
|
|
|
|
hostPath:
|
|
|
|
path: /sys/fs/bpf
|
2018-09-12 15:35:28 +00:00
|
|
|
{% if container_manager == 'crio' %}
|
|
|
|
# To read crio events from the node
|
|
|
|
- name: crio-socket
|
|
|
|
hostPath:
|
|
|
|
path: /var/run/crio/crio.sock
|
|
|
|
{% else %}
|
2018-07-26 20:17:27 +00:00
|
|
|
# To read docker events from the node
|
2018-02-17 03:37:47 +00:00
|
|
|
- name: docker-socket
|
|
|
|
hostPath:
|
|
|
|
path: /var/run/docker.sock
|
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
|
2018-02-17 03:37:47 +00:00
|
|
|
- name: cni-path
|
|
|
|
hostPath:
|
|
|
|
path: /opt/cni/bin
|
2018-07-26 20:17:27 +00:00
|
|
|
# To install cilium cni configuration in the host
|
2018-02-17 03:37:47 +00:00
|
|
|
- name: etc-cni-netd
|
|
|
|
hostPath:
|
2018-07-26 20:17:27 +00:00
|
|
|
path: /etc/cni/net.d
|
|
|
|
# To read the etcd config stored in config maps
|
2018-02-17 03:37:47 +00:00
|
|
|
- name: etcd-config-path
|
|
|
|
configMap:
|
|
|
|
name: cilium-config
|
|
|
|
items:
|
2018-07-26 20:17:27 +00:00
|
|
|
- key: etcd-config
|
|
|
|
path: etcd.config
|
|
|
|
# To read the k8s etcd secrets in case the user might want to use TLS
|
|
|
|
- name: cilium-certs
|
|
|
|
hostPath:
|
|
|
|
path: {{ cilium_cert_dir }}
|
|
|
|
|
|
|
|
restartPolicy: Always
|
2018-02-17 03:37:47 +00:00
|
|
|
tolerations:
|
2018-07-26 20:17:27 +00:00
|
|
|
- effect: NoSchedule
|
|
|
|
key: node-role.kubernetes.io/master
|
|
|
|
- effect: NoSchedule
|
|
|
|
key: node.cloudprovider.kubernetes.io/uninitialized
|
|
|
|
value: "true"
|
|
|
|
# Mark cilium's pod as critical for rescheduling
|
|
|
|
- key: CriticalAddonsOnly
|
|
|
|
operator: "Exists"
|