1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-16 09:16:38 +00:00

doc: add instructions for port forwarding

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
Simon Pasquier 2024-09-09 13:49:53 +02:00
parent 2191f3f4c4
commit d4da9ee1ea
No known key found for this signature in database
GPG key ID: 0190A66C0A10FC4F
2 changed files with 11 additions and 0 deletions

View file

@ -4,6 +4,9 @@ timeout: "1m"
explicitLocalValidators: true
validators:
# Skip localhost examples.
- regex: 'localhost'
type: "ignore"
# docs.github.com returns 403 if not in browser. Cannot curl as well.
- regex: 'docs\.github\.com'
type: "ignore"

View file

@ -82,6 +82,14 @@ Note: The `ServiceMonitor` references a `Service` (not a `Deployment`, or a `Pod
kubectl -n monitoring get secret prometheus-k8s -ojson | jq -r '.data["prometheus.yaml.gz"]' | base64 -d | gunzip | grep "my-service-monitor"
```
You can also use [port forwarding](https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/) to access the Prometheus web.
```sh
kubectl -n monitoring port-forward svc/prometheus-operated 9090:9090
```
If the command runs successfully, you should be able to access the [Prometheus server UI](http://localhost:9090/) via localhost. From there you can check the live configuration and the discovered targets.
#### It is in the configuration but not on the Service Discovery page
ServiceMonitors pointing to Services that do not exist (e.g. nothing matching `.spec.selector`) will lead to this ServiceMonitor not being added to the Service Discovery page. Check if you can find any Service with the selector you configured.