The current example-app setup in the kube-prometheus project is able to
discover scraping targets in the default namespace. It is not able to
discover the configured Alertmanager in the monitoring namespace.
This patch adds an alertmanager-discovery rbac role, to permit the
above described action. In addition it does the following cleanups:
- Remove kubeconfig configuration in deploy and teardown script. kubectl
chooses .kube/config whenever KUBECONFIG is not set by default
- Remove namespace specification option via NAMESPACE env var. In most
of the manifests the metadata/namespace was hardcoded anyways, in
addition in the promtheus frontend role binding the service account
namespace is hardcoded to default as well.
- Instead of `kubectl {apply,delete}` individual manifests, the deploy
and teardown shell scripts {apply,delete} on the entire folder.
The `prometheus-frontend` role of the example app kubeprometheus section
is scoped to the default namespace. Thereby the frontend Prometheus
instance is not able to discover anything outside of the default
namespace. We might as well restrict the front end service monitor to
the default namespace too.
added service account, role and role binding for the prometheus frontend
example, also updated prometheus to use the correct service account
fixes#1049
* namespace has to be kube-system
In order for this service to be discovered by ServiceMonitor k8s-apps-http, it should belong to namespace kube-system.
* namespace has to be kube-system
* namespace has to be kube-system
for service discovery to work within prometheus configuration (ServiceMonitor k8s-app) these service and endpoints should belong to kube-system namespace. Otherwise the service monitor won't fetch it.
* selector was incorrect
selector prometheus: prometheus-frontend is incorrect, the name of the Prometheus resource in the example is "frontend", not "prometheus-frontend"