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:
|
|
|
|
priorityClassName: system-cluster-critical
|
|
|
|
serviceAccountName: kube-router
|
|
|
|
containers:
|
|
|
|
- name: kube-router
|
|
|
|
image: {{ kube_router_image_repo }}:{{ kube_router_image_tag }}
|
|
|
|
imagePullPolicy: IfNotPresent
|
|
|
|
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
|
|
|
|
{% 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 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 %}
|
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
|
2019-04-23 21:46:02 +00:00
|
|
|
initialDelaySeconds: 5
|
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 %}
|
|
|
|
- name: docker-socket
|
|
|
|
mountPath: /var/run/docker.sock
|
|
|
|
readOnly: true
|
|
|
|
{% 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
|
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
|
2019-06-05 10:17:56 +00:00
|
|
|
dnsPolicy: ClusterFirstWithHostNet
|
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
|
|
|
|
# Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12)
|
|
|
|
- key: CriticalAddonsOnly
|
|
|
|
operator: "Exists"
|
|
|
|
volumes:
|
2018-12-10 08:40:39 +00:00
|
|
|
{% if kube_router_enable_dsr %}
|
|
|
|
- name: docker-socket
|
|
|
|
hostPath:
|
|
|
|
path: /var/run/docker.sock
|
|
|
|
type: Socket
|
|
|
|
{% 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
|
|
|
|
|
|
|
|
---
|
|
|
|
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
|