2016-11-03 15:57:11 +00:00
|
|
|
---
|
|
|
|
kind: DaemonSet
|
|
|
|
apiVersion: extensions/v1beta1
|
|
|
|
metadata:
|
|
|
|
name: canal-node
|
2018-03-30 11:29:13 +00:00
|
|
|
namespace: kube-system
|
2016-11-03 15:57:11 +00:00
|
|
|
labels:
|
|
|
|
k8s-app: canal-node
|
|
|
|
spec:
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
k8s-app: canal-node
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
k8s-app: canal-node
|
|
|
|
spec:
|
2018-10-16 22:33:30 +00:00
|
|
|
{% if kube_version is version('v1.11.1', '>=') %}
|
2018-09-25 14:50:22 +00:00
|
|
|
priorityClassName: system-node-critical
|
|
|
|
{% endif %}
|
2016-11-03 15:57:11 +00:00
|
|
|
hostNetwork: true
|
2017-09-04 08:29:40 +00:00
|
|
|
serviceAccountName: canal
|
2017-08-24 09:04:25 +00:00
|
|
|
tolerations:
|
2018-09-27 12:28:54 +00:00
|
|
|
- operator: Exists
|
|
|
|
# Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12)
|
|
|
|
- key: CriticalAddonsOnly
|
|
|
|
operator: "Exists"
|
2016-11-03 15:57:11 +00:00
|
|
|
volumes:
|
|
|
|
# Used by calico/node.
|
|
|
|
- name: lib-modules
|
|
|
|
hostPath:
|
|
|
|
path: /lib/modules
|
2018-08-23 14:17:18 +00:00
|
|
|
- name: var-lib-calico
|
|
|
|
hostPath:
|
|
|
|
path: /var/lib/calico
|
2016-11-03 15:57:11 +00:00
|
|
|
- name: var-run-calico
|
|
|
|
hostPath:
|
|
|
|
path: /var/run/calico
|
|
|
|
# Used to install CNI.
|
|
|
|
- name: cni-bin-dir
|
|
|
|
hostPath:
|
|
|
|
path: /opt/cni/bin
|
|
|
|
- name: cni-net-dir
|
|
|
|
hostPath:
|
|
|
|
path: /etc/cni/net.d
|
|
|
|
# Used by flannel daemon.
|
|
|
|
- name: run-flannel
|
|
|
|
hostPath:
|
|
|
|
path: /run/flannel
|
|
|
|
- name: resolv
|
|
|
|
hostPath:
|
|
|
|
path: /etc/resolv.conf
|
2016-11-14 12:03:54 +00:00
|
|
|
- name: "canal-certs"
|
|
|
|
hostPath:
|
|
|
|
path: "{{ canal_cert_dir }}"
|
2018-08-29 09:42:11 +00:00
|
|
|
- name: xtables-lock
|
|
|
|
hostPath:
|
|
|
|
path: /run/xtables.lock
|
|
|
|
type: FileOrCreate
|
2019-01-28 19:03:49 +00:00
|
|
|
{% if calico_version is version('v3.4.0', '>=') %}
|
|
|
|
initContainers:
|
|
|
|
# This container installs the Calico CNI binaries
|
|
|
|
# and CNI network config file on each node.
|
|
|
|
- name: install-cni
|
|
|
|
image: {{ calico_cni_image_repo }}:{{ calico_cni_image_tag }}
|
|
|
|
command: ["/install-cni.sh"]
|
|
|
|
env:
|
|
|
|
# Name of the CNI config file to create.
|
|
|
|
- name: CNI_CONF_NAME
|
|
|
|
value: "10-canal.conflist"
|
2019-04-02 10:32:36 +00:00
|
|
|
# Install CNI binaries
|
2019-01-28 19:03:49 +00:00
|
|
|
- name: UPDATE_CNI_BINARIES
|
2019-04-02 10:32:36 +00:00
|
|
|
value: "true"
|
2019-01-28 19:03:49 +00:00
|
|
|
# The CNI network config to install on each node.
|
|
|
|
- name: CNI_NETWORK_CONFIG_FILE
|
|
|
|
value: "/host/etc/cni/net.d/canal.conflist.template"
|
|
|
|
# Prevents the container from sleeping forever.
|
|
|
|
- name: SLEEP
|
|
|
|
value: "false"
|
|
|
|
volumeMounts:
|
|
|
|
- mountPath: /host/etc/cni/net.d
|
|
|
|
name: cni-net-dir
|
2019-04-02 10:32:36 +00:00
|
|
|
- mountPath: /host/opt/cni/bin
|
|
|
|
name: cni-bin-dir
|
2019-01-28 19:03:49 +00:00
|
|
|
{% endif %}
|
2016-11-03 15:57:11 +00:00
|
|
|
containers:
|
2019-01-28 19:03:49 +00:00
|
|
|
{% if calico_version is version('v3.3.0', '>=') and calico_version is version('v3.4.0', '<') %}
|
|
|
|
- name: install-cni
|
|
|
|
image: {{ calico_cni_image_repo }}:{{ calico_cni_image_tag }}
|
|
|
|
command: ["/install-cni.sh"]
|
|
|
|
env:
|
|
|
|
# Name of the CNI config file to create.
|
|
|
|
- name: CNI_CONF_NAME
|
|
|
|
value: "10-canal.conflist"
|
2019-04-02 10:32:36 +00:00
|
|
|
# Install CNI binaries
|
2019-01-28 19:03:49 +00:00
|
|
|
- name: UPDATE_CNI_BINARIES
|
2019-04-02 10:32:36 +00:00
|
|
|
value: "true"
|
2019-01-28 19:03:49 +00:00
|
|
|
# The CNI network config to install on each node.
|
|
|
|
- name: CNI_NETWORK_CONFIG_FILE
|
|
|
|
value: "/host/etc/cni/net.d/canal.conflist.template"
|
|
|
|
volumeMounts:
|
|
|
|
- mountPath: /host/etc/cni/net.d
|
|
|
|
name: cni-net-dir
|
2019-04-02 10:32:36 +00:00
|
|
|
- mountPath: /host/opt/cni/bin
|
|
|
|
name: cni-bin-dir
|
2019-01-28 19:03:49 +00:00
|
|
|
{% endif %}
|
2016-11-03 15:57:11 +00:00
|
|
|
# Runs the flannel daemon to enable vxlan networking between
|
|
|
|
# container hosts.
|
|
|
|
- name: flannel
|
|
|
|
image: "{{ flannel_image_repo }}:{{ flannel_image_tag }}"
|
2016-11-22 15:16:04 +00:00
|
|
|
imagePullPolicy: {{ k8s_image_pull_policy }}
|
2016-12-23 14:44:44 +00:00
|
|
|
resources:
|
|
|
|
limits:
|
|
|
|
cpu: {{ flannel_cpu_limit }}
|
|
|
|
memory: {{ flannel_memory_limit }}
|
|
|
|
requests:
|
|
|
|
cpu: {{ flannel_cpu_requests }}
|
|
|
|
memory: {{ flannel_memory_requests }}
|
2016-11-03 15:57:11 +00:00
|
|
|
env:
|
2016-11-08 11:13:20 +00:00
|
|
|
# Cluster name
|
|
|
|
- name: CLUSTER_NAME
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: cluster_name
|
2016-11-03 15:57:11 +00:00
|
|
|
# The location of the etcd cluster.
|
|
|
|
- name: FLANNELD_ETCD_ENDPOINTS
|
2016-11-08 11:13:20 +00:00
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_endpoints
|
2016-11-03 15:57:11 +00:00
|
|
|
# The interface flannel should run on.
|
|
|
|
- name: FLANNELD_IFACE
|
2016-11-08 11:13:20 +00:00
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: flanneld_iface
|
2016-11-03 15:57:11 +00:00
|
|
|
# Perform masquerade on traffic leaving the pod cidr.
|
|
|
|
- name: FLANNELD_IP_MASQ
|
2016-11-08 11:13:20 +00:00
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: masquerade
|
|
|
|
# Set etcd-prefix
|
|
|
|
- name: DOCKER_OPT_ETCD_PREFIX
|
|
|
|
value: "-etcd-prefix=/$(CLUSTER_NAME)/network"
|
2016-11-03 15:57:11 +00:00
|
|
|
# Write the subnet.env file to the mounted directory.
|
|
|
|
- name: FLANNELD_SUBNET_FILE
|
|
|
|
value: "/run/flannel/subnet.env"
|
2016-11-14 12:03:54 +00:00
|
|
|
# Etcd SSL vars
|
|
|
|
- name: ETCD_CA_CERT_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_cafile
|
|
|
|
- name: ETCD_CERT_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_certfile
|
|
|
|
- name: ETCD_KEY_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_keyfile
|
2016-11-03 15:57:11 +00:00
|
|
|
command:
|
|
|
|
- "/bin/sh"
|
|
|
|
- "-c"
|
2016-11-14 12:03:54 +00:00
|
|
|
- "/opt/bin/flanneld -etcd-prefix /$(CLUSTER_NAME)/network -etcd-cafile $(ETCD_CA_CERT_FILE) -etcd-certfile $(ETCD_CERT_FILE) -etcd-keyfile $(ETCD_KEY_FILE)"
|
2016-11-03 15:57:11 +00:00
|
|
|
ports:
|
|
|
|
- hostPort: 10253
|
|
|
|
containerPort: 10253
|
|
|
|
securityContext:
|
|
|
|
privileged: true
|
|
|
|
volumeMounts:
|
|
|
|
- name: "resolv"
|
|
|
|
mountPath: "/etc/resolv.conf"
|
|
|
|
- name: "run-flannel"
|
|
|
|
mountPath: "/run/flannel"
|
2016-11-14 12:03:54 +00:00
|
|
|
- name: "canal-certs"
|
|
|
|
mountPath: "{{ canal_cert_dir }}"
|
2016-11-15 10:18:53 +00:00
|
|
|
readOnly: true
|
2018-08-29 09:42:11 +00:00
|
|
|
- name: xtables-lock
|
|
|
|
mountPath: /run/xtables.lock
|
|
|
|
readOnly: false
|
2016-11-03 15:57:11 +00:00
|
|
|
# Runs calico/node container on each Kubernetes node. This
|
|
|
|
# container programs network policy and local routes on each
|
|
|
|
# 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 }}
|
2016-12-23 14:44:44 +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 }}
|
2016-11-03 15:57:11 +00:00
|
|
|
env:
|
|
|
|
# The location of the etcd cluster.
|
|
|
|
- name: ETCD_ENDPOINTS
|
2016-11-08 11:13:20 +00:00
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_endpoints
|
2016-11-03 15:57:11 +00:00
|
|
|
# Disable Calico BGP. Calico is simply enforcing policy.
|
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
|
|
|
|
value: "kubespray,canal"
|
2016-11-03 15:57:11 +00:00
|
|
|
# Disable file logging so `kubectl logs` works.
|
|
|
|
- name: CALICO_DISABLE_FILE_LOGGING
|
|
|
|
value: "true"
|
2018-02-05 19:34:59 +00:00
|
|
|
# Set noderef for node controller.
|
|
|
|
- name: CALICO_K8S_NODE_REF
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: spec.nodeName
|
|
|
|
- name: FELIX_HEALTHENABLED
|
|
|
|
value: "true"
|
2019-01-04 16:00:56 +00:00
|
|
|
# Prior to v3.2.1 iptables didn't acquire the lock, so Calico's own implementation of the lock should be used,
|
|
|
|
# this is not required in later versions https://github.com/projectcalico/calico/issues/2179
|
|
|
|
{% if calico_version is version('v3.2.1', '<') %}
|
|
|
|
- name: FELIX_IPTABLESLOCKTIMEOUTSECS
|
|
|
|
value: "10"
|
|
|
|
{% endif %}
|
2016-11-14 12:03:54 +00:00
|
|
|
# Etcd SSL vars
|
|
|
|
- name: ETCD_CA_CERT_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_cafile
|
|
|
|
- name: ETCD_CERT_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_certfile
|
|
|
|
- name: ETCD_KEY_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: canal-config
|
|
|
|
key: etcd_keyfile
|
2017-09-04 08:29:40 +00:00
|
|
|
- name: NODENAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: spec.nodeName
|
2016-11-03 15:57:11 +00:00
|
|
|
securityContext:
|
|
|
|
privileged: true
|
2018-02-05 19:34:59 +00:00
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /liveness
|
|
|
|
port: 9099
|
|
|
|
periodSeconds: 10
|
|
|
|
initialDelaySeconds: 10
|
|
|
|
failureThreshold: 6
|
|
|
|
readinessProbe:
|
2019-01-28 19:03:49 +00:00
|
|
|
{% if calico_version is version('v3.3.0', '<')%}
|
2018-02-05 19:34:59 +00:00
|
|
|
httpGet:
|
|
|
|
path: /readiness
|
|
|
|
port: 9099
|
2019-01-28 19:03:49 +00:00
|
|
|
{% else %}
|
|
|
|
exec:
|
|
|
|
command:
|
|
|
|
- /bin/calico-node
|
|
|
|
- -bird-ready
|
|
|
|
- -felix-ready
|
|
|
|
{% endif %}
|
2018-02-05 19:34:59 +00:00
|
|
|
periodSeconds: 10
|
2016-11-03 15:57:11 +00:00
|
|
|
volumeMounts:
|
|
|
|
- mountPath: /lib/modules
|
|
|
|
name: lib-modules
|
|
|
|
readOnly: true
|
|
|
|
- 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
|
2016-11-14 12:03:54 +00:00
|
|
|
- name: "canal-certs"
|
|
|
|
mountPath: "{{ canal_cert_dir }}"
|
2016-11-15 10:18:53 +00:00
|
|
|
readOnly: true
|
2019-01-04 16:00:56 +00:00
|
|
|
- name: xtables-lock
|
|
|
|
mountPath: /run/xtables.lock
|
|
|
|
readOnly: false
|
2017-08-29 18:35:27 +00:00
|
|
|
updateStrategy:
|
|
|
|
rollingUpdate:
|
2017-09-15 12:19:37 +00:00
|
|
|
maxUnavailable: {{ serial | default('20%') }}
|
2017-08-29 18:35:27 +00:00
|
|
|
type: RollingUpdate
|