2019-09-11 03:06:55 +08:00
|
|
|
apiVersion: apps/v1
|
2018-10-16 22:15:05 +08: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-11 03:06:55 +08:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
k8s-app: kube-router
|
|
|
|
tier: node
|
2018-10-16 22:15:05 +08:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
k8s-app: kube-router
|
|
|
|
tier: node
|
2019-12-16 20:35:36 +08: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 22:15:05 +08:00
|
|
|
spec:
|
|
|
|
priorityClassName: system-cluster-critical
|
|
|
|
serviceAccountName: kube-router
|
|
|
|
containers:
|
|
|
|
- name: kube-router
|
|
|
|
image: {{ kube_router_image_repo }}:{{ kube_router_image_tag }}
|
2020-05-11 02:37:50 +08:00
|
|
|
imagePullPolicy: {{ k8s_image_pull_policy }}
|
2018-10-16 22:15:05 +08: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 23:54:06 +08:00
|
|
|
- --bgp-graceful-restart=true
|
2018-10-16 22:15:05 +08: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 %}
|
|
|
|
{% if kube_router_peer_router_asns %}
|
2018-11-19 16:34:05 +08:00
|
|
|
- --peer-router-asns={{ kube_router_peer_router_asns }}
|
2018-10-16 22:15:05 +08:00
|
|
|
{% endif %}
|
|
|
|
{% if kube_router_peer_router_ips %}
|
2018-11-19 16:34:05 +08:00
|
|
|
- --peer-router-ips={{ kube_router_peer_router_ips }}
|
2018-10-16 22:15:05 +08:00
|
|
|
{% endif %}
|
|
|
|
{% if kube_router_peer_router_ports %}
|
2018-11-19 16:34:05 +08:00
|
|
|
- --peer-router-ports={{ kube_router_peer_router_ports }}
|
2018-10-16 22:15:05 +08:00
|
|
|
{% endif %}
|
2019-12-16 20:35:36 +08:00
|
|
|
{% if kube_router_enable_metrics %}
|
|
|
|
- --metrics-path={{ kube_router_metrics_path }}
|
|
|
|
- --metrics-port={{ kube_router_metrics_port }}
|
|
|
|
{% endif %}
|
2018-10-16 22:15:05 +08:00
|
|
|
{% for arg in kube_router_extra_args %}
|
|
|
|
- "{{ arg }}"
|
|
|
|
{% endfor %}
|
|
|
|
env:
|
|
|
|
- name: NODE_NAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: spec.nodeName
|
2020-03-17 17:40:21 +08:00
|
|
|
- name: KUBE_ROUTER_CNI_CONF_FILE
|
|
|
|
value: /etc/cni/net.d/10-kuberouter.conflist
|
2018-10-16 22:15:05 +08:00
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /healthz
|
|
|
|
port: 20244
|
2020-06-30 23:54:06 +08:00
|
|
|
initialDelaySeconds: 10
|
2018-10-16 22:15:05 +08:00
|
|
|
periodSeconds: 3
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
cpu: 250m
|
|
|
|
memory: 250Mi
|
|
|
|
securityContext:
|
|
|
|
privileged: true
|
|
|
|
volumeMounts:
|
2018-12-10 16:40:39 +08:00
|
|
|
{% if kube_router_enable_dsr %}
|
|
|
|
- name: docker-socket
|
|
|
|
mountPath: /var/run/docker.sock
|
|
|
|
readOnly: true
|
|
|
|
{% endif %}
|
2018-10-16 22:15:05 +08: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 23:54:06 +08:00
|
|
|
- name: xtables-lock
|
|
|
|
mountPath: /run/xtables.lock
|
|
|
|
readOnly: false
|
2019-12-16 20:35:36 +08: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 22:15:05 +08:00
|
|
|
hostNetwork: true
|
2019-06-05 18:17:56 +08:00
|
|
|
dnsPolicy: ClusterFirstWithHostNet
|
2018-12-10 16:40:39 +08:00
|
|
|
{% if kube_router_enable_dsr %}
|
|
|
|
hostIPC: true
|
|
|
|
hostPID: true
|
|
|
|
{% endif %}
|
2018-10-16 22:15:05 +08:00
|
|
|
tolerations:
|
|
|
|
- operator: Exists
|
|
|
|
volumes:
|
2018-12-10 16:40:39 +08:00
|
|
|
{% if kube_router_enable_dsr %}
|
|
|
|
- name: docker-socket
|
|
|
|
hostPath:
|
|
|
|
path: /var/run/docker.sock
|
|
|
|
type: Socket
|
|
|
|
{% endif %}
|
2018-10-16 22:15:05 +08: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 23:54:06 +08:00
|
|
|
- name: xtables-lock
|
|
|
|
hostPath:
|
|
|
|
path: /run/xtables.lock
|
|
|
|
type: FileOrCreate
|
2018-10-16 22:15:05 +08:00
|
|
|
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ServiceAccount
|
|
|
|
metadata:
|
|
|
|
name: kube-router
|
|
|
|
namespace: kube-system
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: ClusterRole
|
2020-04-15 04:14:04 +08:00
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
2018-10-16 22:15:05 +08: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-15 04:14:04 +08:00
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
2018-10-16 22:15:05 +08: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
|