2022-07-22 07:46:19 +00:00
|
|
|
# Source: calico/templates/calico-node.yaml
|
|
|
|
# This manifest installs the canal container, as well
|
|
|
|
# as the CNI plugins and network config on
|
|
|
|
# each master and worker node in a Kubernetes cluster.
|
2016-11-03 15:57:11 +00:00
|
|
|
kind: DaemonSet
|
2019-09-10 19:06:55 +00:00
|
|
|
apiVersion: apps/v1
|
2016-11-03 15:57:11 +00:00
|
|
|
metadata:
|
2022-07-22 07:46:19 +00:00
|
|
|
name: canal
|
2018-03-30 11:29:13 +00:00
|
|
|
namespace: kube-system
|
2016-11-03 15:57:11 +00:00
|
|
|
labels:
|
2022-07-22 07:46:19 +00:00
|
|
|
k8s-app: canal
|
2016-11-03 15:57:11 +00:00
|
|
|
spec:
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
2022-07-22 07:46:19 +00:00
|
|
|
k8s-app: canal
|
|
|
|
updateStrategy:
|
|
|
|
type: RollingUpdate
|
|
|
|
rollingUpdate:
|
|
|
|
maxUnavailable: {{ serial | default('20%') }}
|
2016-11-03 15:57:11 +00:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
2022-07-22 07:46:19 +00:00
|
|
|
k8s-app: canal
|
2016-11-03 15:57:11 +00:00
|
|
|
spec:
|
2022-07-22 07:46:19 +00:00
|
|
|
nodeSelector:
|
|
|
|
kubernetes.io/os: linux
|
2016-11-03 15:57:11 +00:00
|
|
|
hostNetwork: true
|
2017-08-24 09:04:25 +00:00
|
|
|
tolerations:
|
2022-07-22 07:46:19 +00:00
|
|
|
# Make sure canal gets scheduled on all nodes.
|
|
|
|
- effect: NoSchedule
|
|
|
|
operator: Exists
|
|
|
|
# Mark the pod as a critical add-on for rescheduling.
|
|
|
|
- key: CriticalAddonsOnly
|
|
|
|
operator: Exists
|
|
|
|
- effect: NoExecute
|
|
|
|
operator: Exists
|
|
|
|
serviceAccountName: canal
|
|
|
|
# Minimize downtime during a rolling upgrade or deletion; tell Kubernetes to do a "force
|
|
|
|
# deletion": https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods.
|
|
|
|
terminationGracePeriodSeconds: 0
|
|
|
|
priorityClassName: system-node-critical
|
2019-01-28 19:03:49 +00:00
|
|
|
initContainers:
|
2022-07-22 07:46:19 +00:00
|
|
|
# This container installs the CNI binaries
|
2019-01-28 19:03:49 +00:00
|
|
|
# and CNI network config file on each node.
|
|
|
|
- name: install-cni
|
|
|
|
image: {{ calico_cni_image_repo }}:{{ calico_cni_image_tag }}
|
2022-07-22 13:28:07 +00:00
|
|
|
imagePullPolicy: {{ k8s_image_pull_policy }}
|
2020-09-10 10:45:46 +00:00
|
|
|
command: ["/opt/cni/bin/install"]
|
2022-07-22 07:46:19 +00:00
|
|
|
envFrom:
|
|
|
|
- configMapRef:
|
|
|
|
# Allow KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT to be overridden for eBPF mode.
|
|
|
|
name: kubernetes-services-endpoint
|
|
|
|
optional: true
|
2019-01-28 19:03:49 +00:00
|
|
|
env:
|
2022-07-22 07:46:19 +00:00
|
|
|
# Set the serviceaccount name to use for the Calico CNI plugin.
|
|
|
|
# We use canal-node instead of calico-node when using flannel networking.
|
|
|
|
- name: CALICO_CNI_SERVICE_ACCOUNT
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: spec.serviceAccountName
|
2019-01-28 19:03:49 +00:00
|
|
|
# Name of the CNI config file to create.
|
|
|
|
- name: CNI_CONF_NAME
|
|
|
|
value: "10-canal.conflist"
|
|
|
|
# The CNI network config to install on each node.
|
2022-07-22 07:46:19 +00:00
|
|
|
- name: CNI_NETWORK_CONFIG
|
2016-11-08 11:13:20 +00:00
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
2022-07-22 07:46:19 +00:00
|
|
|
key: cni_network_config
|
|
|
|
# Set the hostname based on the k8s node name.
|
|
|
|
- name: KUBERNETES_NODE_NAME
|
2016-11-14 12:03:54 +00:00
|
|
|
valueFrom:
|
2022-07-22 07:46:19 +00:00
|
|
|
fieldRef:
|
|
|
|
fieldPath: spec.nodeName
|
2022-07-22 13:28:07 +00:00
|
|
|
# The location of the etcd cluster.
|
|
|
|
- name: ETCD_ENDPOINTS
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_endpoints
|
|
|
|
# Location of the CA certificate for etcd.
|
|
|
|
- name: ETCD_CA_CERT_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_ca
|
|
|
|
# Location of the client key for etcd.
|
|
|
|
- name: ETCD_KEY_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_key
|
|
|
|
# Location of the client certificate for etcd.
|
|
|
|
- name: ETCD_CERT_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_cert
|
2022-07-22 07:46:19 +00:00
|
|
|
# CNI MTU Config variable
|
|
|
|
- name: CNI_MTU
|
2016-11-14 12:03:54 +00:00
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
2022-07-22 07:46:19 +00:00
|
|
|
key: veth_mtu
|
|
|
|
# Prevents the container from sleeping forever.
|
|
|
|
- name: SLEEP
|
|
|
|
value: "false"
|
|
|
|
volumeMounts:
|
|
|
|
- mountPath: /host/opt/cni/bin
|
|
|
|
name: cni-bin-dir
|
|
|
|
- mountPath: /host/etc/cni/net.d
|
|
|
|
name: cni-net-dir
|
2022-07-22 13:28:07 +00:00
|
|
|
- mountPath: /calico-secrets
|
|
|
|
name: etcd-certs
|
2016-11-03 15:57:11 +00:00
|
|
|
securityContext:
|
|
|
|
privileged: true
|
2022-07-22 07:46:19 +00:00
|
|
|
# This init container mounts the necessary filesystems needed by the BPF data plane
|
|
|
|
# i.e. bpf at /sys/fs/bpf and cgroup2 at /run/calico/cgroup. Calico-node initialisation is executed
|
|
|
|
# in best effort fashion, i.e. no failure for errors, to not disrupt pod creation in iptable mode.
|
|
|
|
- name: "mount-bpffs"
|
|
|
|
image: "{{ calico_node_image_repo }}:{{ calico_node_image_tag }}"
|
|
|
|
imagePullPolicy: {{ k8s_image_pull_policy }}
|
|
|
|
command: ["calico-node", "-init", "-best-effort"]
|
2016-11-03 15:57:11 +00:00
|
|
|
volumeMounts:
|
2022-07-22 07:46:19 +00:00
|
|
|
- mountPath: /sys/fs
|
|
|
|
name: sys-fs
|
|
|
|
# Bidirectional is required to ensure that the new mount we make at /sys/fs/bpf propagates to the host
|
|
|
|
# so that it outlives the init container.
|
|
|
|
mountPropagation: Bidirectional
|
|
|
|
- mountPath: /var/run/calico
|
|
|
|
name: var-run-calico
|
|
|
|
# Bidirectional is required to ensure that the new mount we make at /run/calico/cgroup propagates to the host
|
|
|
|
# so that it outlives the init container.
|
|
|
|
mountPropagation: Bidirectional
|
|
|
|
# Mount /proc/ from host which usually is an init program at /nodeproc. It's needed by mountns binary,
|
|
|
|
# executed by calico-node, to mount root cgroup2 fs at /run/calico/cgroup to attach CTLB programs correctly.
|
|
|
|
- mountPath: /nodeproc
|
|
|
|
name: nodeproc
|
2016-11-15 10:18:53 +00:00
|
|
|
readOnly: true
|
2022-07-22 07:46:19 +00:00
|
|
|
securityContext:
|
|
|
|
privileged: true
|
|
|
|
containers:
|
|
|
|
# Runs canal container on each Kubernetes node. This
|
|
|
|
# container programs network policy and routes on each
|
2016-11-03 15:57:11 +00:00
|
|
|
# host.
|
|
|
|
- name: calico-node
|
|
|
|
image: "{{ calico_node_image_repo }}:{{ calico_node_image_tag }}"
|
2016-11-22 15:16:04 +00:00
|
|
|
imagePullPolicy: {{ k8s_image_pull_policy }}
|
2022-07-22 07:46:19 +00:00
|
|
|
envFrom:
|
|
|
|
- configMapRef:
|
|
|
|
# Allow KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT to be overridden for eBPF mode.
|
|
|
|
name: kubernetes-services-endpoint
|
|
|
|
optional: true
|
2016-11-03 15:57:11 +00:00
|
|
|
env:
|
2022-07-22 13:28:07 +00:00
|
|
|
# The location of the etcd cluster.
|
|
|
|
- name: ETCD_ENDPOINTS
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_endpoints
|
|
|
|
# Location of the CA certificate for etcd.
|
|
|
|
- name: ETCD_CA_CERT_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_ca
|
|
|
|
# Location of the client key for etcd.
|
|
|
|
- name: ETCD_KEY_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_key
|
|
|
|
# Location of the client certificate for etcd.
|
|
|
|
- name: ETCD_CERT_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_cert
|
|
|
|
# Set noderef for node controller.
|
|
|
|
- name: CALICO_K8S_NODE_REF
|
2016-11-08 11:13:20 +00:00
|
|
|
valueFrom:
|
2022-07-22 07:46:19 +00:00
|
|
|
fieldRef:
|
|
|
|
fieldPath: spec.nodeName
|
|
|
|
# Set the serviceaccount name to use for the Calico CNI plugin.
|
|
|
|
# We use canal-node instead of calico-node when using flannel networking.
|
|
|
|
- name: CALICO_CNI_SERVICE_ACCOUNT
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: spec.serviceAccountName
|
|
|
|
# Don't enable BGP.
|
2018-02-05 19:34:59 +00:00
|
|
|
- name: CALICO_NETWORKING_BACKEND
|
|
|
|
value: "none"
|
2017-08-07 15:33:37 +00:00
|
|
|
# Cluster type to identify the deployment type
|
|
|
|
- name: CLUSTER_TYPE
|
2022-07-22 07:46:19 +00:00
|
|
|
value: "k8s,canal"
|
|
|
|
# Period, in seconds, at which felix re-applies all iptables state
|
|
|
|
- name: FELIX_IPTABLESREFRESHINTERVAL
|
|
|
|
value: "60"
|
|
|
|
# No IP address needed.
|
|
|
|
- name: IP
|
|
|
|
value: ""
|
|
|
|
# The default IPv4 pool to create on startup if none exists. Pod IPs will be
|
|
|
|
# chosen from this range. Changing this value after installation will have
|
|
|
|
# no effect. This should fall within `--cluster-cidr`.
|
|
|
|
# - name: CALICO_IPV4POOL_CIDR
|
|
|
|
# value: "192.168.0.0/16"
|
2016-11-03 15:57:11 +00:00
|
|
|
# Disable file logging so `kubectl logs` works.
|
|
|
|
- name: CALICO_DISABLE_FILE_LOGGING
|
|
|
|
value: "true"
|
2022-07-22 07:46:19 +00:00
|
|
|
# Set Felix endpoint to host default action to ACCEPT.
|
|
|
|
- name: FELIX_DEFAULTENDPOINTTOHOSTACTION
|
|
|
|
value: "ACCEPT"
|
2020-03-24 14:10:49 +00:00
|
|
|
# Disable IPv6 on Kubernetes.
|
|
|
|
- name: FELIX_IPV6SUPPORT
|
|
|
|
value: "false"
|
2022-07-22 07:46:19 +00:00
|
|
|
- name: FELIX_HEALTHENABLED
|
|
|
|
value: "true"
|
2016-11-03 15:57:11 +00:00
|
|
|
securityContext:
|
|
|
|
privileged: true
|
2022-07-22 07:46:19 +00:00
|
|
|
resources:
|
|
|
|
limits:
|
|
|
|
cpu: {{ calico_node_cpu_limit }}
|
|
|
|
memory: {{ calico_node_memory_limit }}
|
|
|
|
requests:
|
|
|
|
cpu: {{ calico_node_cpu_requests }}
|
|
|
|
memory: {{ calico_node_memory_requests }}
|
|
|
|
lifecycle:
|
|
|
|
preStop:
|
|
|
|
exec:
|
|
|
|
command:
|
|
|
|
- /bin/calico-node
|
|
|
|
- -shutdown
|
2018-02-05 19:34:59 +00:00
|
|
|
livenessProbe:
|
2019-01-28 19:03:49 +00:00
|
|
|
exec:
|
|
|
|
command:
|
|
|
|
- /bin/calico-node
|
2022-07-22 07:46:19 +00:00
|
|
|
- -felix-live
|
2018-02-05 19:34:59 +00:00
|
|
|
periodSeconds: 10
|
2022-07-22 07:46:19 +00:00
|
|
|
initialDelaySeconds: 10
|
|
|
|
failureThreshold: 6
|
|
|
|
timeoutSeconds: 10
|
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /readiness
|
|
|
|
port: 9099
|
|
|
|
host: localhost
|
|
|
|
periodSeconds: 10
|
|
|
|
timeoutSeconds: 10
|
2016-11-03 15:57:11 +00:00
|
|
|
volumeMounts:
|
2022-07-22 07:46:19 +00:00
|
|
|
# For maintaining CNI plugin API credentials.
|
|
|
|
- mountPath: /host/etc/cni/net.d
|
|
|
|
name: cni-net-dir
|
|
|
|
readOnly: false
|
2016-11-03 15:57:11 +00:00
|
|
|
- mountPath: /lib/modules
|
|
|
|
name: lib-modules
|
|
|
|
readOnly: true
|
2022-07-22 07:46:19 +00:00
|
|
|
- mountPath: /run/xtables.lock
|
|
|
|
name: xtables-lock
|
|
|
|
readOnly: false
|
2016-11-03 15:57:11 +00:00
|
|
|
- mountPath: /var/run/calico
|
|
|
|
name: var-run-calico
|
|
|
|
readOnly: false
|
2018-08-23 14:17:18 +00:00
|
|
|
- mountPath: /var/lib/calico
|
|
|
|
name: var-lib-calico
|
|
|
|
readOnly: false
|
2022-07-22 13:28:07 +00:00
|
|
|
- mountPath: /calico-secrets
|
|
|
|
name: etcd-certs
|
2022-07-22 07:46:19 +00:00
|
|
|
- name: policysync
|
|
|
|
mountPath: /var/run/nodeagent
|
|
|
|
# For eBPF mode, we need to be able to mount the BPF filesystem at /sys/fs/bpf so we mount in the
|
|
|
|
# parent directory.
|
|
|
|
- name: bpffs
|
|
|
|
mountPath: /sys/fs/bpf
|
|
|
|
- name: cni-log-dir
|
|
|
|
mountPath: /var/log/calico/cni
|
2016-11-15 10:18:53 +00:00
|
|
|
readOnly: true
|
2022-07-22 13:28:07 +00:00
|
|
|
# Runs the flannel daemon to enable vxlan networking between
|
|
|
|
# container hosts.
|
|
|
|
- name: flannel
|
2022-07-22 07:46:19 +00:00
|
|
|
image: "{{ flannel_image_repo }}:{{ flannel_image_tag }}"
|
2022-07-22 13:28:07 +00:00
|
|
|
command: [ "/opt/bin/flanneld", "--ip-masq", "--kube-subnet-mgr"]
|
2022-07-22 07:46:19 +00:00
|
|
|
imagePullPolicy: {{ k8s_image_pull_policy }}
|
|
|
|
env:
|
2022-07-22 13:28:07 +00:00
|
|
|
# The location of the etcd cluster.
|
|
|
|
- name: FLANNELD_ETCD_ENDPOINTS
|
2022-07-22 07:46:19 +00:00
|
|
|
valueFrom:
|
2022-07-22 13:28:07 +00:00
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_endpoints
|
|
|
|
# Location of the CA certificate for etcd.
|
|
|
|
- name: ETCD_CA_CERT_FILE
|
2022-07-22 07:46:19 +00:00
|
|
|
valueFrom:
|
2022-07-22 13:28:07 +00:00
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_ca
|
|
|
|
# Location of the client key for etcd.
|
|
|
|
- name: ETCD_KEY_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_key
|
|
|
|
# Location of the client certificate for etcd.
|
|
|
|
- name: ETCD_CERT_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_cert
|
|
|
|
# Location of the CA certificate for etcd.
|
|
|
|
- name: FLANNELD_ETCD_CAFILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_ca
|
|
|
|
# Location of the client key for etcd.
|
|
|
|
- name: FLANNELD_ETCD_KEYFILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_key
|
|
|
|
# Location of the client certificate for etcd.
|
|
|
|
- name: FLANNELD_ETCD_CERTFILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_cert
|
|
|
|
# The interface flannel should run on.
|
2022-07-22 07:46:19 +00:00
|
|
|
- name: FLANNELD_IFACE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: canal_iface
|
2022-07-22 13:28:07 +00:00
|
|
|
# Perform masquerade on traffic leaving the pod cidr.
|
2022-07-22 07:46:19 +00:00
|
|
|
- name: FLANNELD_IP_MASQ
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: masquerade
|
2022-07-22 13:28:07 +00:00
|
|
|
# Write the subnet.env file to the mounted directory.
|
|
|
|
- name: FLANNELD_SUBNET_FILE
|
|
|
|
value: "/run/flannel/subnet.env"
|
|
|
|
- name: POD_NAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.name
|
|
|
|
- name: POD_NAMESPACE
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.namespace
|
|
|
|
securityContext:
|
|
|
|
privileged: true
|
2022-07-22 07:46:19 +00:00
|
|
|
volumeMounts:
|
2022-07-22 13:28:07 +00:00
|
|
|
- mountPath: /etc/resolv.conf
|
|
|
|
name: resolv
|
|
|
|
- mountPath: /run/flannel
|
|
|
|
name: run-flannel
|
|
|
|
- mountPath: /calico-secrets
|
|
|
|
name: etcd-certs
|
|
|
|
- name: flannel-cfg
|
|
|
|
mountPath: /etc/kube-flannel/
|
2022-07-22 07:46:19 +00:00
|
|
|
volumes:
|
2022-07-22 13:28:07 +00:00
|
|
|
- name: flannel-cfg
|
|
|
|
configMap:
|
|
|
|
name: canal-config
|
|
|
|
# Used by canal-node.
|
2022-07-22 07:46:19 +00:00
|
|
|
- name: lib-modules
|
|
|
|
hostPath:
|
|
|
|
path: /lib/modules
|
|
|
|
- name: var-run-calico
|
|
|
|
hostPath:
|
|
|
|
path: /var/run/calico
|
|
|
|
- name: var-lib-calico
|
|
|
|
hostPath:
|
|
|
|
path: /var/lib/calico
|
|
|
|
- name: xtables-lock
|
|
|
|
hostPath:
|
|
|
|
path: /run/xtables.lock
|
|
|
|
type: FileOrCreate
|
|
|
|
- name: sys-fs
|
|
|
|
hostPath:
|
|
|
|
path: /sys/fs/
|
|
|
|
type: DirectoryOrCreate
|
|
|
|
- name: bpffs
|
|
|
|
hostPath:
|
|
|
|
path: /sys/fs/bpf
|
|
|
|
type: Directory
|
|
|
|
# mount /proc at /nodeproc to be used by mount-bpffs initContainer to mount root cgroup2 fs.
|
|
|
|
- name: nodeproc
|
|
|
|
hostPath:
|
|
|
|
path: /proc
|
|
|
|
# Used by flannel.
|
2022-07-22 13:28:07 +00:00
|
|
|
- name: run-flannel
|
|
|
|
hostPath:
|
|
|
|
path: /run/flannel
|
|
|
|
- name: resolv
|
|
|
|
hostPath:
|
|
|
|
path: /etc/resolv.conf
|
2022-07-22 07:46:19 +00:00
|
|
|
# Used to install CNI.
|
|
|
|
- name: cni-bin-dir
|
|
|
|
hostPath:
|
|
|
|
path: /opt/cni/bin
|
|
|
|
- name: cni-net-dir
|
|
|
|
hostPath:
|
|
|
|
path: /etc/cni/net.d
|
|
|
|
# Used to access CNI logs.
|
|
|
|
- name: cni-log-dir
|
|
|
|
hostPath:
|
|
|
|
path: /var/log/calico/cni
|
2022-07-22 13:28:07 +00:00
|
|
|
# Mount in the etcd TLS secrets with mode 400.
|
|
|
|
# See https://kubernetes.io/docs/concepts/configuration/secret/
|
|
|
|
- name: etcd-certs
|
|
|
|
secret:
|
|
|
|
secretName: calico-etcd-secrets
|
|
|
|
defaultMode: 0400
|
2022-07-22 07:46:19 +00:00
|
|
|
# Used to create per-pod Unix Domain Sockets
|
|
|
|
- name: policysync
|
|
|
|
hostPath:
|
|
|
|
type: DirectoryOrCreate
|
|
|
|
path: /var/run/nodeagent
|