Comments (14)
Hi @JaeGerW2016
Can you verify that version-checker is exposing the metrics on 8080, the expected Prometheus is scrapping the metrics, and that your grafana dashboard has right selected data source.
from version-checker.
The following is my deployment which use static manifest and metrics information
root@node1:/opt# k get ep -n monitoring -l app=version-checker
NAME ENDPOINTS AGE
version-checker 172.20.2.171:8080 4m5s
root@node1:/opt# curl http://172.20.2.171:8080/metrics
# HELP version_checker_is_latest_version Where the container in use is using the latest upstream registry version
# TYPE version_checker_is_latest_version gauge
version_checker_is_latest_version{container="alertmanager",current_version="v0.20.0",image="quay.io/prometheus/alertmanager",latest_version="v0.21.0",namespace="monitoring",pod="alertmanager-prom-prometheus-operator-alertmanager-0"} 0
version_checker_is_latest_version{container="autoscaler",current_version="1.6.0",image="gcr.io/google-containers/cluster-proportional-autoscaler-amd64",latest_version="1.8.1",namespace="kube-system",pod="dns-autoscaler-79599df498-cqxvx"} 0
version_checker_is_latest_version{container="cilium-agent",current_version="v1.8.2",image="docker.io/cilium/cilium",latest_version="v1.8.2",namespace="kube-system",pod="cilium-69twj"} 1
from version-checker.
@JaeGerW2016 It looks like it is correctly exposing the version metrics. Next try querying the Prometheus that you are trying to scrape with. It may not be configured to look at the version-checker pod/service
from version-checker.
The following is version-checker pod/service describe informatin, in deployment manifest .spec.template.spec.container
use commad ["version-checker", "-a"]
root@node1:/opt# kubectl describe pod version-checker-7f45545d65-5299h -n monitoring
Name: version-checker-7f45545d65-5299h
Namespace: monitoring
Priority: 0
Node: node3/192.168.2.12
Start Time: Tue, 25 Aug 2020 08:41:01 +0000
Labels: app=version-checker
pod-template-hash=7f45545d65
Annotations: enable.version-checker.io/version-checker: true
prometheus.io/path: /metrics
prometheus.io/port: 8080
prometheus.io/scrape: true
...
root@node1:/opt# k describe svc version-checker -n monitoring
Name: version-checker
Namespace: monitoring
Labels: app=version-checker
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"version-checker"},"name":"version-checker","namespace":"...
Selector: app=version-checker
Type: ClusterIP
IP: 10.244.238.181
Port: web 8080/TCP
TargetPort: 8080/TCP
Endpoints: 172.20.2.171:8080
Session Affinity: None
Events: <none>
from version-checker.
Hi @JaeGerW2016 can you share what Prometheus configuration you are using?
Are you installing it with prometheus-operator? Have you creates a ServiceMonitor for the version-checker?
from version-checker.
I deployed version-checker and prometheus-operater in the same namespace: monitoring, and also configured the servicemonitor for version-checker.
root@node1:/opt# k get servicemonitor -n monitoring -l app=version-checker -o yaml
apiVersion: v1
items:
- apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"monitoring.coreos.com/v1","kind":"ServiceMonitor","metadata":{"annotations":{},"labels":{"app":"version-checker"},"name":"version-checker","namespace":"monitoring"},"spec":{"endpoints":[{"path":"/metrics","port":"web"}],"namespaceSelector":{"matchNames":["monitoring"]},"selector":{"matchLabels":{"app":"version-checker"}}}}
creationTimestamp: "2020-08-25T08:41:17Z"
generation: 1
labels:
app: version-checker
name: version-checker
namespace: monitoring
resourceVersion: "35804818"
selfLink: /apis/monitoring.coreos.com/v1/namespaces/monitoring/servicemonitors/version-checker
uid: 7d2671c4-8af1-4e22-a41f-ff349ff98c04
spec:
endpoints:
- path: /metrics
port: web
namespaceSelector:
matchNames:
- monitoring
selector:
matchLabels:
app: version-checker
kind: List
metadata:
resourceVersion: ""
selfLink: ""
from version-checker.
Is there a Prometheus object which has a service monitor label selector for app: version-checker
?
from version-checker.
My understanding is that the servicemonitor's selector.matchLabels corresponds to the labels in the service, and there are labels in version-checker's svc: app=version-checker
I don't know if my understanding of this selector is correct.
root@node1:/opt# k describe svc version-checker -n monitoring
Name: version-checker
Namespace: monitoring
Labels: app=version-checker
...
from version-checker.
Yes, that's correct however there needs to be a Prometheus instance which has another label selector for the service monitor.
from version-checker.
Don't quite understand what you're saying about a Prometheus instance which has another label selector for the service monitor.
from version-checker.
For a Prometheus to scrape the version-checker, it will need to be configured to use the service monitor you have created. For example, here is a Prometheus object which will use that service montior, which is using the label app=version-checker
.
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
name: version-checker
labels:
prometheus: version-checker
app.kubernetes.io/name: version-checker
spec:
replicas: 1
serviceAccountName: prometheus
version: v2.20.1
serviceMonitorSelector:
matchLabels:
app: version-checker
from version-checker.
p.s. you could always kubectl port-forward {your-prometheus-instance} 9090
and go to localhost:9090
. Then go to "targets" in the menu. This gives a good indication of what is being set-up as a target and what its status is.
from version-checker.
Thank you for your patience, having already identified the cause of the problem based on your mention of.
is caused by a problem with the podMonitorSelector and serviceMonitorSelector of the prometheus instance.
The following is a partial configuration of the prometheus instance
podMonitorSelector:
matchLabels:
release: prom
...
serviceMonitorSelector:
matchLabels:
release: prom
Since we share a prometheus instance, we modify the serviceMonitor and deployment configuration of version-checker by adding a label:
labels:
app: version-checker
release: prom
it works!
@JoshVanL
from version-checker.
@JaeGerW2016 Great! Glad you got is working! 😄
from version-checker.
Related Issues (20)
- Please add Pod Labels in Helm Chart HOT 2
- Error on OCI style repositories HOT 2
- Unauthorized error on public ECR repository HOT 3
- Error when setting override to docker.io/busybox HOT 1
- Provide GHCR example HOT 1
- Allow for excluding specific containers HOT 2
- False positives for strange tag versions HOT 3
- add nodeSelector to the chart
- Helm Chart Upgrades Fail due to immutable selector fields in deployment.
- Feat req.: Add deployment tolerations
- Read proxy from environment when using the fallback/selfhosted client
- version-checker seemingly leaks memory and gets oom-killed HOT 2
- Gitlab support HOT 2
- Add kubernetes probes support HOT 1
- ACR Tokens support for authentication
- Error prometheus metrics HOT 1
- Error when using the Harbor as selfhosted. HOT 6
- Is this project still active? Container Image update? HOT 5
- Fixing already deprecated apiVersion for Role and RoleBinding of k8s manifests
- x509: certificate signed by unknown authority
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from version-checker.