2019-09-10 19:06:55 +00:00
|
|
|
apiVersion: apps/v1
|
2018-10-16 14:15:05 +00:00
|
|
|
kind: DaemonSet
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
k8s-app: kube-router
|
|
|
|
tier: node
|
|
|
|
name: kube-router
|
|
|
|
namespace: kube-system
|
|
|
|
spec:
|
|
|
|
minReadySeconds: 3
|
|
|
|
updateStrategy:
|
|
|
|
rollingUpdate:
|
|
|
|
maxUnavailable: 1
|
|
|
|
type: RollingUpdate
|
2019-09-10 19:06:55 +00:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
k8s-app: kube-router
|
|
|
|
tier: node
|
2018-10-16 14:15:05 +00:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
k8s-app: kube-router
|
|
|
|
tier: node
|
2019-12-16 12:35:36 +00:00
|
|
|
annotations:
|
|
|
|
{% if kube_router_enable_metrics %}
|
|
|
|
prometheus.io/path: {{ kube_router_metrics_path }}
|
|
|
|
prometheus.io/port: "{{ kube_router_metrics_port }}"
|
|
|
|
prometheus.io/scrape: "true"
|
|
|
|
{% endif %}
|
2018-10-16 14:15:05 +00:00
|
|
|
spec:
|
2020-10-05 20:46:20 +00:00
|
|
|
priorityClassName: system-node-critical
|
2018-10-16 14:15:05 +00:00
|
|
|
serviceAccountName: kube-router
|
|
|
|
containers:
|
|
|
|
- name: kube-router
|
|
|
|
image: {{ kube_router_image_repo }}:{{ kube_router_image_tag }}
|
2020-05-10 18:37:50 +00:00
|
|
|
imagePullPolicy: {{ k8s_image_pull_policy }}
|
2018-10-16 14:15:05 +00:00
|
|
|
args:
|
|
|
|
- --run-router={{ kube_router_run_router | bool }}
|
|
|
|
- --run-firewall={{ kube_router_run_firewall | bool }}
|
|
|
|
- --run-service-proxy={{ kube_router_run_service_proxy | bool }}
|
|
|
|
- --kubeconfig=/var/lib/kube-router/kubeconfig
|
2020-06-30 15:54:06 +00:00
|
|
|
- --bgp-graceful-restart=true
|
2018-10-16 14:15:05 +00:00
|
|
|
{% if kube_router_advertise_cluster_ip %}
|
|
|
|
- --advertise-cluster-ip
|
|
|
|
{% endif %}
|
|
|
|
{% if kube_router_advertise_external_ip %}
|
|
|
|
- --advertise-external-ip
|
|
|
|
{% endif %}
|
|
|
|
{% if kube_router_advertise_loadbalancer_ip %}
|
|
|
|
- --advertise-loadbalancer-ip
|
|
|
|
{% endif %}
|
2022-05-23 23:39:10 +00:00
|
|
|
{% if kube_router_cluster_asn %}
|
|
|
|
- --cluster-asn={{ kube_router_cluster_asn }}
|
|
|
|
{% endif %}
|
2018-10-16 14:15:05 +00:00
|
|
|
{% if kube_router_peer_router_asns %}
|
2018-11-19 08:34:05 +00:00
|
|
|
- --peer-router-asns={{ kube_router_peer_router_asns }}
|
2018-10-16 14:15:05 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if kube_router_peer_router_ips %}
|
2018-11-19 08:34:05 +00:00
|
|
|
- --peer-router-ips={{ kube_router_peer_router_ips }}
|
2018-10-16 14:15:05 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if kube_router_peer_router_ports %}
|
2018-11-19 08:34:05 +00:00
|
|
|
- --peer-router-ports={{ kube_router_peer_router_ports }}
|
2018-10-16 14:15:05 +00:00
|
|
|
{% endif %}
|
2019-12-16 12:35:36 +00:00
|
|
|
{% if kube_router_enable_metrics %}
|
|
|
|
- --metrics-path={{ kube_router_metrics_path }}
|
|
|
|
- --metrics-port={{ kube_router_metrics_port }}
|
|
|
|
{% endif %}
|
2022-03-18 01:05:39 +00:00
|
|
|
{% if kube_router_enable_dsr %}
|
|
|
|
{% if container_manager == "docker" %}
|
|
|
|
- --runtime-endpoint=unix:///var/run/docker.sock
|
|
|
|
{% endif %}
|
|
|
|
{% if container_manager == "containerd" %}
|
|
|
|
{% endif %}
|
|
|
|
- --runtime-endpoint=unix:///run/containerd/containerd.sock
|
|
|
|
{% endif %}
|
2018-10-16 14:15:05 +00:00
|
|
|
{% for arg in kube_router_extra_args %}
|
|
|
|
- "{{ arg }}"
|
|
|
|
{% endfor %}
|
|
|
|
env:
|
|
|
|
- name: NODE_NAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: spec.nodeName
|
2020-03-17 09:40:21 +00:00
|
|
|
- name: KUBE_ROUTER_CNI_CONF_FILE
|
|
|
|
value: /etc/cni/net.d/10-kuberouter.conflist
|
2018-10-16 14:15:05 +00:00
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /healthz
|
|
|
|
port: 20244
|
2020-06-30 15:54:06 +00:00
|
|
|
initialDelaySeconds: 10
|
2018-10-16 14:15:05 +00:00
|
|
|
periodSeconds: 3
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
cpu: 250m
|
|
|
|
memory: 250Mi
|
|
|
|
securityContext:
|
|
|
|
privileged: true
|
|
|
|
volumeMounts:
|
2018-12-10 08:40:39 +00:00
|
|
|
{% if kube_router_enable_dsr %}
|
2022-03-18 01:05:39 +00:00
|
|
|
{% if container_manager == "docker" %}
|
2018-12-10 08:40:39 +00:00
|
|
|
- name: docker-socket
|
|
|
|
mountPath: /var/run/docker.sock
|
|
|
|
readOnly: true
|
2022-03-18 01:05:39 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if container_manager == "containerd" %}
|
|
|
|
- name: containerd-socket
|
|
|
|
mountPath: /run/containerd/containerd.sock
|
|
|
|
readOnly: true
|
|
|
|
{% endif %}
|
2018-12-10 08:40:39 +00:00
|
|
|
{% endif %}
|
2018-10-16 14:15:05 +00:00
|
|
|
- name: lib-modules
|
|
|
|
mountPath: /lib/modules
|
|
|
|
readOnly: true
|
|
|
|
- name: cni-conf-dir
|
|
|
|
mountPath: /etc/cni/net.d
|
|
|
|
- name: kubeconfig
|
|
|
|
mountPath: /var/lib/kube-router
|
|
|
|
readOnly: true
|
2020-06-30 15:54:06 +00:00
|
|
|
- name: xtables-lock
|
|
|
|
mountPath: /run/xtables.lock
|
|
|
|
readOnly: false
|
2019-12-16 12:35:36 +00:00
|
|
|
{% if kube_router_enable_metrics %}
|
|
|
|
ports:
|
|
|
|
- containerPort: {{ kube_router_metrics_port }}
|
|
|
|
hostPort: {{ kube_router_metrics_port }}
|
|
|
|
name: metrics
|
|
|
|
protocol: TCP
|
|
|
|
{% endif %}
|
2018-10-16 14:15:05 +00:00
|
|
|
hostNetwork: true
|
2020-09-04 11:53:41 +00:00
|
|
|
dnsPolicy: {{ kube_router_dns_policy }}
|
2018-12-10 08:40:39 +00:00
|
|
|
{% if kube_router_enable_dsr %}
|
|
|
|
hostIPC: true
|
|
|
|
hostPID: true
|
|
|
|
{% endif %}
|
2018-10-16 14:15:05 +00:00
|
|
|
tolerations:
|
|
|
|
- operator: Exists
|
|
|
|
volumes:
|
2018-12-10 08:40:39 +00:00
|
|
|
{% if kube_router_enable_dsr %}
|
2022-03-18 01:05:39 +00:00
|
|
|
{% if container_manager == "docker" %}
|
2018-12-10 08:40:39 +00:00
|
|
|
- name: docker-socket
|
|
|
|
hostPath:
|
|
|
|
path: /var/run/docker.sock
|
|
|
|
type: Socket
|
2022-03-18 01:05:39 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if container_manager == "containerd" %}
|
|
|
|
- name: containerd-socket
|
|
|
|
hostPath:
|
|
|
|
path: /run/containerd/containerd.sock
|
|
|
|
type: Socket
|
|
|
|
{% endif %}
|
2018-12-10 08:40:39 +00:00
|
|
|
{% endif %}
|
2018-10-16 14:15:05 +00:00
|
|
|
- name: lib-modules
|
|
|
|
hostPath:
|
|
|
|
path: /lib/modules
|
|
|
|
- name: cni-conf-dir
|
|
|
|
hostPath:
|
|
|
|
path: /etc/cni/net.d
|
|
|
|
- name: kubeconfig
|
|
|
|
hostPath:
|
|
|
|
path: /var/lib/kube-router
|
2020-06-30 15:54:06 +00:00
|
|
|
- name: xtables-lock
|
|
|
|
hostPath:
|
|
|
|
path: /run/xtables.lock
|
|
|
|
type: FileOrCreate
|
2018-10-16 14:15:05 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ServiceAccount
|
|
|
|
metadata:
|
|
|
|
name: kube-router
|
|
|
|
namespace: kube-system
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: ClusterRole
|
2020-04-14 20:14:04 +00:00
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
2018-10-16 14:15:05 +00:00
|
|
|
metadata:
|
|
|
|
name: kube-router
|
|
|
|
namespace: kube-system
|
|
|
|
rules:
|
|
|
|
- apiGroups:
|
|
|
|
- ""
|
|
|
|
resources:
|
|
|
|
- namespaces
|
|
|
|
- pods
|
|
|
|
- services
|
|
|
|
- nodes
|
|
|
|
- endpoints
|
|
|
|
verbs:
|
|
|
|
- list
|
|
|
|
- get
|
|
|
|
- watch
|
|
|
|
- apiGroups:
|
|
|
|
- "networking.k8s.io"
|
|
|
|
resources:
|
|
|
|
- networkpolicies
|
|
|
|
verbs:
|
|
|
|
- list
|
|
|
|
- get
|
|
|
|
- watch
|
|
|
|
- apiGroups:
|
|
|
|
- extensions
|
|
|
|
resources:
|
|
|
|
- networkpolicies
|
|
|
|
verbs:
|
|
|
|
- get
|
|
|
|
- list
|
|
|
|
- watch
|
|
|
|
---
|
|
|
|
kind: ClusterRoleBinding
|
2020-04-14 20:14:04 +00:00
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
2018-10-16 14:15:05 +00:00
|
|
|
metadata:
|
|
|
|
name: kube-router
|
|
|
|
roleRef:
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
kind: ClusterRole
|
|
|
|
name: kube-router
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: kube-router
|
|
|
|
namespace: kube-system
|