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