Add kube-router configuration to enable metrics exposure (#5416)

pull/5421/head
bozzo 2019-12-16 13:35:36 +01:00 committed by Kubernetes Prow Robot
parent 8bb1af9926
commit c0b262a22a
3 changed files with 35 additions and 0 deletions

View File

@ -47,3 +47,12 @@
# Array of common annotations for every node
# kube_router_annotations_all: []
# Enables scraping kube-router metrics with Prometheus
# kube_router_enable_metrics: false
# Path to serve Prometheus metrics on
# kube_router_metrics_path: /metrics
# Prometheus metrics port to use
# kube_router_metrics_port: 9255

View File

@ -49,3 +49,12 @@ kube_router_annotations_node: []
# Array of common annotations for every node
kube_router_annotations_all: []
# Enables scraping kube-router metrics with Prometheus
kube_router_enable_metrics: false
# Path to serve Prometheus metrics on
kube_router_metrics_path: /metrics
# Prometheus metrics port to use
kube_router_metrics_port: 9255

View File

@ -65,6 +65,12 @@ spec:
labels:
k8s-app: kube-router
tier: node
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 %}
spec:
priorityClassName: system-cluster-critical
serviceAccountName: kube-router
@ -95,6 +101,10 @@ spec:
{% if kube_router_peer_router_ports %}
- --peer-router-ports={{ kube_router_peer_router_ports }}
{% endif %}
{% if kube_router_enable_metrics %}
- --metrics-path={{ kube_router_metrics_path }}
- --metrics-port={{ kube_router_metrics_port }}
{% endif %}
{% for arg in kube_router_extra_args %}
- "{{ arg }}"
{% endfor %}
@ -129,6 +139,13 @@ spec:
- name: kubeconfig
mountPath: /var/lib/kube-router
readOnly: true
{% if kube_router_enable_metrics %}
ports:
- containerPort: {{ kube_router_metrics_port }}
hostPort: {{ kube_router_metrics_port }}
name: metrics
protocol: TCP
{% endif %}
initContainers:
- name: install-cni
image: {{ busybox_image_repo }}:{{ busybox_image_tag }}