Skip to content

Commit

Permalink
Merge pull request #67 from wrongerror/main
Browse files Browse the repository at this point in the history
[prometheus-node-exporter] Fix port conflict issue with hostNetwork set to true
  • Loading branch information
benjaminhuo authored Jun 4, 2024
2 parents 68aa087 + 7ea1807 commit 919b0b2
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 51 deletions.
2 changes: 1 addition & 1 deletion charts/prometheus-node-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ keywords:
- prometheus
- exporter
type: application
version: 4.21.7
version: 4.21.8
appVersion: 1.6.0
home: https://github.com/prometheus/node_exporter/
sources:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
image: '{{ include "calico-exporter.common.image" $imageDict }}'
imagePullPolicy: {{ .Values.CalicoExporter.image.pullPolicy }}
args:
- --web.listen-address=127.0.0.1:{{ .Values.CalicoExporter.service.innerPort }}
- --web.listen-address=127.0.0.1:{{ .Values.CalicoExporter.bgpService.innerPort }}
- --collector.enable-collectors=bgp
resources:
{{ toYaml .Values.CalicoExporter.resources | indent 12 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ spec:
containers:
- args:
- --logtostderr
- --secure-listen-address=0.0.0.0:{{ .Values.service.targetPort }}
- --secure-listen-address=0.0.0.0:{{ .Values.ippoolService.targetPort }}
- --tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
- --upstream=http://127.0.0.1:{{ .Values.service.innerPort }}/
- --upstream=http://127.0.0.1:{{ .Values.ippoolService.innerPort }}/
image: '{{ include "calico-exporter.kubeRbacProxy.image" . }}'
imagePullPolicy: {{ .Values.kubeRbacProxy.image.pullPolicy }}
name: kube-rbac-proxy
ports:
- containerPort: {{ .Values.service.targetPort }}
- containerPort: {{ .Values.ippoolService.targetPort }}
name: https-metrics
resources:
{{ toYaml .Values.kubeRbacProxy.resources | indent 12 }}
Expand All @@ -47,7 +47,7 @@ spec:
image: '{{ include "calico-exporter.common.image" . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- --web.listen-address=127.0.0.1:{{ .Values.service.innerPort }}
- --web.listen-address=127.0.0.1:{{ .Values.ippoolService.innerPort }}
- --collector.enable-collectors=ippool
resources:
{{ toYaml .Values.resources | indent 12 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ metadata:
labels:
{{- include "calico-exporter.ippool-collector.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
type: {{ .Values.ippoolService.type }}
ports:
- name: https-metrics
port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
port: {{ .Values.ippoolService.port }}
targetPort: {{ .Values.ippoolService.targetPort }}
selector:
{{- include "calico-exporter.ippool-collector.selectorLabels" . | nindent 4 }}
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ calicoService:
annotations:
prometheus.io/scrape: "true"

service:
bgpService:
type: ClusterIP
port: 9094
targetPort: 9094
Expand All @@ -36,6 +36,15 @@ service:
annotations:
prometheus.io/scrape: "true"

ippoolService:
type: ClusterIP
port: 9096
targetPort: 9096
innerPort: 9095
nodePort:
annotations:
prometheus.io/scrape: "true"

# Labels to add to the pod
podLabels: {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ data:
}
{{- if .Values.CalicoExporter.enabled }}
location /metrics/calico {
proxy_pass http://localhost:{{ .Values.CalicoExporter.service.innerPort }}/metrics;
proxy_pass http://localhost:{{ .Values.CalicoExporter.bgpService.innerPort }}/metrics;
}
{{- end }}
{{- if .Values.ProcessExporter.enabled }}
Expand Down
11 changes: 10 additions & 1 deletion charts/prometheus-node-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ CalicoExporter:
annotations:
prometheus.io/scrape: "true"

service:
bgpService:
type: ClusterIP
port: 19094
targetPort: 19094
Expand All @@ -668,6 +668,15 @@ CalicoExporter:
annotations:
prometheus.io/scrape: "true"

ippoolService:
type: ClusterIP
port: 19096
targetPort: 19096
innerPort: 19095
nodePort:
annotations:
prometheus.io/scrape: "true"

# Labels to add to the pod
podLabels:
app.kubernetes.io/name: prometheus-node-exporter
Expand Down

0 comments on commit 919b0b2

Please sign in to comment.