2017-09-04 08:29:51 +00:00
|
|
|
---
|
|
|
|
# This manifest installs the calico/node container, as well
|
|
|
|
# as the Calico CNI plugins and network config on
|
|
|
|
# each master and worker node in a Kubernetes cluster.
|
|
|
|
kind: DaemonSet
|
|
|
|
apiVersion: extensions/v1beta1
|
|
|
|
metadata:
|
|
|
|
name: calico-node
|
2018-03-30 11:29:13 +00:00
|
|
|
namespace: kube-system
|
2017-09-04 08:29:51 +00:00
|
|
|
labels:
|
|
|
|
k8s-app: calico-node
|
|
|
|
spec:
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
k8s-app: calico-node
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
k8s-app: calico-node
|
|
|
|
annotations:
|
2018-09-27 12:28:54 +00:00
|
|
|
# Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12)
|
2017-09-13 18:00:51 +00:00
|
|
|
kubespray.etcd-cert/serial: "{{ etcd_client_cert_serial }}"
|
2018-11-14 23:01:35 +00:00
|
|
|
{% if calico_felix_prometheusmetricsenabled %}
|
|
|
|
prometheus.io/scrape: 'true'
|
|
|
|
prometheus.io/port: "{{ calico_felix_prometheusmetricsport }}"
|
|
|
|
{% endif %}
|
2017-09-04 08:29:51 +00:00
|
|
|
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 %}
|
2017-09-04 08:29:51 +00:00
|
|
|
hostNetwork: true
|
|
|
|
serviceAccountName: calico-node
|
|
|
|
tolerations:
|
2019-01-28 19:03:49 +00:00
|
|
|
- effect: NoExecute
|
|
|
|
operator: Exists
|
|
|
|
- effect: NoSchedule
|
|
|
|
operator: Exists
|
2018-09-27 12:28:54 +00:00
|
|
|
# Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12)
|
|
|
|
- key: CriticalAddonsOnly
|
|
|
|
operator: "Exists"
|
2018-02-05 19:34:59 +00:00
|
|
|
# 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
|
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-calico.conflist"
|
|
|
|
# CNI binaries are already on the host
|
|
|
|
- name: UPDATE_CNI_BINARIES
|
|
|
|
value: "false"
|
|
|
|
# The CNI network config to install on each node.
|
|
|
|
- name: CNI_NETWORK_CONFIG_FILE
|
|
|
|
value: "/host/etc/cni/net.d/calico.conflist.template"
|
|
|
|
# Prevents the container from sleeping forever.
|
|
|
|
- name: SLEEP
|
|
|
|
value: "false"
|
|
|
|
volumeMounts:
|
|
|
|
- mountPath: /host/etc/cni/net.d
|
|
|
|
name: cni-net-dir
|
|
|
|
{% endif %}
|
2017-09-04 08:29:51 +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-calico.conflist"
|
|
|
|
# CNI binaries are already on the host
|
|
|
|
- name: UPDATE_CNI_BINARIES
|
|
|
|
value: "false"
|
|
|
|
# The CNI network config to install on each node.
|
|
|
|
- name: CNI_NETWORK_CONFIG_FILE
|
|
|
|
value: "/host/etc/cni/net.d/calico.conflist.template"
|
|
|
|
# Prevents the container from sleeping forever.
|
|
|
|
- name: SLEEP
|
|
|
|
value: "false"
|
|
|
|
volumeMounts:
|
|
|
|
- mountPath: /host/etc/cni/net.d
|
|
|
|
name: cni-net-dir
|
|
|
|
{% endif %}
|
2017-09-04 08:29:51 +00:00
|
|
|
# Runs calico/node container on each Kubernetes node. This
|
|
|
|
# container programs network policy and routes on each
|
|
|
|
# host.
|
|
|
|
- name: calico-node
|
|
|
|
image: {{ calico_node_image_repo }}:{{ calico_node_image_tag }}
|
|
|
|
env:
|
|
|
|
# The location of the Calico etcd cluster.
|
|
|
|
- name: ETCD_ENDPOINTS
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: calico-config
|
|
|
|
key: etcd_endpoints
|
|
|
|
# Choose the backend to use.
|
|
|
|
- name: CALICO_NETWORKING_BACKEND
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: calico-config
|
|
|
|
key: calico_backend
|
|
|
|
# Cluster type to identify the deployment type
|
|
|
|
- name: CLUSTER_TYPE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: calico-config
|
|
|
|
key: cluster_type
|
2018-02-05 19:34:59 +00:00
|
|
|
# Set noderef for node controller.
|
|
|
|
- name: CALICO_K8S_NODE_REF
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: spec.nodeName
|
2017-09-04 08:29:51 +00:00
|
|
|
# Disable file logging so `kubectl logs` works.
|
|
|
|
- name: CALICO_DISABLE_FILE_LOGGING
|
|
|
|
value: "true"
|
|
|
|
# Set Felix endpoint to host default action to ACCEPT.
|
|
|
|
- name: FELIX_DEFAULTENDPOINTTOHOSTACTION
|
|
|
|
value: "{{ calico_endpoint_to_host_action|default('RETURN') }}"
|
2018-09-18 12:48:29 +00:00
|
|
|
- name: FELIX_HEALTHHOST
|
|
|
|
value: "{{ calico_healthhost }}"
|
2019-02-04 20:42:40 +00:00
|
|
|
{% if kube_proxy_mode == 'ipvs' and kube_apiserver_node_port_range is defined %}
|
|
|
|
- name: FELIX_KUBENODEPORTRANGES
|
|
|
|
value: "{{ kube_apiserver_node_port_range.split('-')[0] }}:{{ kube_apiserver_node_port_range.split('-')[1] }}"
|
|
|
|
{% endif %}
|
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 %}
|
2017-09-04 08:29:51 +00:00
|
|
|
# should be set in etcd before deployment
|
|
|
|
# # Configure the IP Pool from which Pod IPs will be chosen.
|
|
|
|
# - name: CALICO_IPV4POOL_CIDR
|
|
|
|
# value: "192.168.0.0/16"
|
2018-10-12 07:09:36 +00:00
|
|
|
- name: CALICO_IPV4POOL_IPIP
|
|
|
|
value: "{{ calico_ipv4pool_ipip }}"
|
2017-09-04 08:29:51 +00:00
|
|
|
# Disable IPv6 on Kubernetes.
|
|
|
|
- name: FELIX_IPV6SUPPORT
|
|
|
|
value: "false"
|
|
|
|
# Set Felix logging to "info"
|
|
|
|
- name: FELIX_LOGSEVERITYSCREEN
|
2018-11-28 08:55:01 +00:00
|
|
|
value: "{{ calico_loglevel }}"
|
2017-09-04 08:29:51 +00:00
|
|
|
# Set MTU for tunnel device used if ipip is enabled
|
|
|
|
{% if calico_mtu is defined %}
|
|
|
|
- name: FELIX_IPINIPMTU
|
|
|
|
value: "{{ calico_mtu }}"
|
|
|
|
{% endif %}
|
2017-10-03 21:24:05 +00:00
|
|
|
- name: FELIX_PROMETHEUSMETRICSENABLED
|
|
|
|
value: "{{ calico_felix_prometheusmetricsenabled }}"
|
|
|
|
- name: FELIX_PROMETHEUSMETRICSPORT
|
|
|
|
value: "{{ calico_felix_prometheusmetricsport }}"
|
|
|
|
- name: FELIX_PROMETHEUSGOMETRICSENABLED
|
|
|
|
value: "{{ calico_felix_prometheusgometricsenabled }}"
|
|
|
|
- name: FELIX_PROMETHEUSPROCESSMETRICSENABLED
|
|
|
|
value: "{{ calico_felix_prometheusprocessmetricsenabled }}"
|
2019-01-28 19:03:49 +00:00
|
|
|
{% if calico_version is version('v3.4.0', '>=') and calico_advertise_cluster_ips|default(false) %}
|
|
|
|
- name: CALICO_ADVERTISE_CLUSTER_IPS
|
|
|
|
value: "{{ kube_service_addresses }}"
|
|
|
|
{% endif %}
|
2017-09-04 08:29:51 +00:00
|
|
|
# Location of the CA certificate for etcd.
|
|
|
|
- name: ETCD_CA_CERT_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: calico-config
|
|
|
|
key: etcd_ca
|
|
|
|
# Location of the client key for etcd.
|
|
|
|
- name: ETCD_KEY_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: calico-config
|
|
|
|
key: etcd_key
|
|
|
|
# Location of the client certificate for etcd.
|
|
|
|
- name: ETCD_CERT_FILE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: calico-config
|
|
|
|
key: etcd_cert
|
2018-03-23 13:33:20 +00:00
|
|
|
{% if calico_ip_auto_method is defined %}
|
2018-03-23 22:46:26 +00:00
|
|
|
- name: IP_AUTODETECTION_METHOD
|
|
|
|
value: "{{ calico_ip_auto_method }}"
|
2019-01-28 07:09:18 +00:00
|
|
|
- name: IP
|
|
|
|
value: "autodetect"
|
2018-03-23 13:33:20 +00:00
|
|
|
{% else %}
|
2017-09-04 08:29:51 +00:00
|
|
|
- name: IP
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: status.hostIP
|
2018-03-23 13:33:20 +00:00
|
|
|
{% endif %}
|
2017-09-04 08:29:51 +00:00
|
|
|
- name: NODENAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: spec.nodeName
|
|
|
|
- name: FELIX_HEALTHENABLED
|
|
|
|
value: "true"
|
2017-11-13 09:35:13 +00:00
|
|
|
- name: FELIX_IGNORELOOSERPF
|
|
|
|
value: "{{ calico_node_ignorelooserpf }}"
|
2017-09-04 08:29:51 +00:00
|
|
|
securityContext:
|
|
|
|
privileged: true
|
|
|
|
resources:
|
|
|
|
limits:
|
|
|
|
cpu: {{ calico_node_cpu_limit }}
|
|
|
|
memory: {{ calico_node_memory_limit }}
|
|
|
|
requests:
|
|
|
|
cpu: {{ calico_node_cpu_requests }}
|
|
|
|
memory: {{ calico_node_memory_requests }}
|
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
2018-09-06 13:57:21 +00:00
|
|
|
host: 127.0.0.1
|
2017-09-04 08:29:51 +00:00
|
|
|
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', '<') %}
|
2017-09-04 08:29:51 +00:00
|
|
|
httpGet:
|
2018-09-06 13:57:21 +00:00
|
|
|
host: 127.0.0.1
|
2017-09-04 08:29:51 +00:00
|
|
|
path: /readiness
|
|
|
|
port: 9099
|
2019-01-28 19:03:49 +00:00
|
|
|
{% else %}
|
|
|
|
exec:
|
|
|
|
command:
|
|
|
|
- /bin/calico-node
|
|
|
|
- -bird-ready
|
|
|
|
- -felix-ready
|
|
|
|
{% endif %}
|
2017-09-04 08:29:51 +00:00
|
|
|
periodSeconds: 10
|
|
|
|
volumeMounts:
|
|
|
|
- mountPath: /lib/modules
|
|
|
|
name: lib-modules
|
|
|
|
readOnly: true
|
|
|
|
- mountPath: /var/run/calico
|
|
|
|
name: var-run-calico
|
2018-08-23 14:17:18 +00:00
|
|
|
- mountPath: /var/lib/calico
|
|
|
|
name: var-lib-calico
|
2017-09-04 08:29:51 +00:00
|
|
|
readOnly: false
|
|
|
|
- mountPath: /calico-secrets
|
|
|
|
name: etcd-certs
|
2019-01-04 16:00:56 +00:00
|
|
|
- name: xtables-lock
|
|
|
|
mountPath: /run/xtables.lock
|
|
|
|
readOnly: false
|
2017-09-04 08:29:51 +00:00
|
|
|
volumes:
|
|
|
|
# Used by calico/node.
|
|
|
|
- name: lib-modules
|
|
|
|
hostPath:
|
|
|
|
path: /lib/modules
|
|
|
|
- name: var-run-calico
|
|
|
|
hostPath:
|
|
|
|
path: /var/run/calico
|
2018-08-23 14:17:18 +00:00
|
|
|
- name: var-lib-calico
|
|
|
|
hostPath:
|
|
|
|
path: /var/lib/calico
|
2017-09-04 08:29:51 +00:00
|
|
|
# Used to install CNI.
|
|
|
|
- name: cni-net-dir
|
|
|
|
hostPath:
|
|
|
|
path: /etc/cni/net.d
|
|
|
|
# Mount in the etcd TLS secrets.
|
|
|
|
- name: etcd-certs
|
|
|
|
hostPath:
|
|
|
|
path: "{{ calico_cert_dir }}"
|
2019-01-04 16:00:56 +00:00
|
|
|
# Mount the global iptables lock file, used by calico/node
|
|
|
|
- name: xtables-lock
|
|
|
|
hostPath:
|
|
|
|
path: /run/xtables.lock
|
|
|
|
type: FileOrCreate
|
2017-09-04 08:29:51 +00:00
|
|
|
updateStrategy:
|
|
|
|
rollingUpdate:
|
2017-09-15 12:19:37 +00:00
|
|
|
maxUnavailable: {{ serial | default('20%') }}
|
2018-09-27 12:28:54 +00:00
|
|
|
type: RollingUpdate
|