fix: add named port 'http' to vin-decoder Service and container for ServiceMonitor scraping #230
Reference in New Issue
Block a user
Delete Branch "feature/fix-vin-decoder-servicemonitor-port"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The
ServiceMonitoratflux/vin-decoder/servicemonitor.yamlreferencesport: http(name-based lookup), but the vin-decoder Service had an anonymous port (port: 80, targetPort: 3000) and the container had no named port.Prometheus ServiceMonitor port discovery requires the port name to match between the Service spec and the ServiceMonitor
endpoints[].portfield. Without a matching named port, Prometheus would fail to discover the scrape target and no metrics would be collected.Changes
flux/vin-decoder/helmrelease.yaml: Addedname: httpto the containercontainerPort: 3000flux/vin-decoder/helmrelease.yaml: Addedname: httpto the Service port (port: 80 -> targetPort: 3000)Validation
kustomize build flux/= PASS ✅Related
The ServiceMonitor at flux/vin-decoder/servicemonitor.yaml references port by name ('http'), but the Service had anonymous port 80 -> 3000 and the container had no named port. Prometheus ServiceMonitor port matching requires the port name to match between the Service and the ServiceMonitor spec. Adds: - name: http to the containerPort (port 3000) - name: http to the Service port (port 80 -> targetPort 3000) This allows the kube-prometheus-stack ServiceMonitor to correctly scrape /metrics from vin-decoder pods. Closes leeworks-agents/api-company#174