Skip to content

Commit

Permalink
Add namespace selector to service monitors
Browse files Browse the repository at this point in the history
  • Loading branch information
ianunruh committed Aug 10, 2021
1 parent d0edafe commit 74e377e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,17 @@ kubectl kustomize "https://github.com/ianunruh/shelly-exporter.git/deploy/basic?

Refer to the [target overlay](deploy/target) to learn how to configure the
targets for this exporter.

## Security

There are two security considerations to make when deploying this exporter.

1. When using authentication, the exporter acts as an authenticated proxy to any
web server that is passed in the "target" param. This could result in the auth
credentials being exposed. This means the exporter should be locked down with
an ingress NetworkPolicy to prevent access to clients other than Prometheus.

2. Any service monitors should have a namespace selector specified to prevent
unauthorized services from being used to configure Prometheus to scrape them.
The monitors provided in the [basic deployment](deploy/basic) are locked down
to the `monitoring` namespace, for example.
3 changes: 3 additions & 0 deletions deploy/basic/service-monitor-target.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ kind: ServiceMonitor
metadata:
name: shelly-exporter-target
spec:
namespaceSelector:
matchNames:
- monitoring
selector:
matchLabels:
app.kubernetes.io/name: shelly-exporter-target
Expand Down
3 changes: 3 additions & 0 deletions deploy/basic/service-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ kind: ServiceMonitor
metadata:
name: shelly-exporter
spec:
namespaceSelector:
matchNames:
- monitoring
selector:
matchLabels:
app.kubernetes.io/name: shelly-exporter
Expand Down

0 comments on commit 74e377e

Please sign in to comment.