Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kube-router configuration to enable metrics exposure #5416

Merged
merged 1 commit into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions roles/network_plugin/kube-router/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions roles/network_plugin/kube-router/templates/kube-router.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 %}
Expand Down Expand Up @@ -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 }}
Expand Down