Add documentation for example service monitoring
This commit is contained in:
43
README.md
43
README.md
@@ -22,23 +22,46 @@ which manages Prometheus servers and their configuration in your cluster. To ins
|
|||||||
controller, the [node_exporter](https://github.com/prometheus/node_exporter),
|
controller, the [node_exporter](https://github.com/prometheus/node_exporter),
|
||||||
[Grafana](https://grafana.org) including default dashboards, and the Prometheus server, run:
|
[Grafana](https://grafana.org) including default dashboards, and the Prometheus server, run:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
export KUBECONFIG=<path> # defaults to "~/.kube/config"
|
export KUBECONFIG=<path> # defaults to "~/.kube/config"
|
||||||
export KUBE_NAMESPACE=<ns> # defaults to "default"
|
export KUBE_NAMESPACE=<ns> # defaults to "default"
|
||||||
hack/cluster-monitoring/deploy
|
hack/cluster-monitoring/deploy
|
||||||
```
|
```
|
||||||
|
|
||||||
To tear it all down again, run:
|
|
||||||
|
|
||||||
```
|
|
||||||
hack/cluster-monitoring/teardown
|
|
||||||
```
|
|
||||||
|
|
||||||
After all pods are ready, you can reach:
|
After all pods are ready, you can reach:
|
||||||
|
|
||||||
* Prometheus UI on node port `30900`
|
* Prometheus UI on node port `30900`
|
||||||
* Grafana on node port `30902`
|
* Grafana on node port `30902`
|
||||||
|
|
||||||
|
To tear it all down again, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hack/cluster-monitoring/teardown
|
||||||
|
```
|
||||||
|
|
||||||
|
__All services in the manifest still contain the `prometheus.io/scrape = true` annotations. It is not
|
||||||
|
used by the Prometheus controller. They remain for convential deployments as in
|
||||||
|
[this example configuration](https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus-kubernetes.yml).__
|
||||||
|
|
||||||
## Monitoring custom services
|
## Monitoring custom services
|
||||||
|
|
||||||
TODO
|
The example manifests in [/manifests/examples/example-app](/manifests/examples/example-app)
|
||||||
|
deploy a fake service into the `production` and `development` namespaces and define
|
||||||
|
a Prometheus server monitoring them.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl --kubeconfig="$KUBECONFIG" create namespace production
|
||||||
|
kubectl --kubeconfig="$KUBECONFIG" create namespace development
|
||||||
|
hack/cluster-monitoring/deploy
|
||||||
|
```
|
||||||
|
|
||||||
|
After all pods are ready you can reach the Prometheus server monitoring your services
|
||||||
|
on node port `30100`.
|
||||||
|
|
||||||
|
Teardown:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hack/cluster-monitoring/teardown
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
7
hack/example-service-monitoring/deploy
Executable file
7
hack/example-service-monitoring/deploy
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [ -z "${KUBECONFIG}" ]; then
|
||||||
|
KUBECONFIG=~/.kube/config
|
||||||
|
fi
|
||||||
|
|
||||||
|
kubectl --kubeconfig="$KUBECONFIG" create -f manifests/examples/example-app
|
7
hack/example-service-monitoring/teardown
Executable file
7
hack/example-service-monitoring/teardown
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [ -z "${KUBECONFIG}" ]; then
|
||||||
|
KUBECONFIG=~/.kube/config
|
||||||
|
fi
|
||||||
|
|
||||||
|
kubectl --kubeconfig="$KUBECONFIG" -n "$KUBE_NAMESPACE" delete -f manifests/examples/example-app
|
@@ -2,6 +2,7 @@ apiVersion: v1
|
|||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: prometheus-frontend
|
name: prometheus-frontend
|
||||||
|
namespace: default
|
||||||
spec:
|
spec:
|
||||||
type: NodePort
|
type: NodePort
|
||||||
ports:
|
ports:
|
||||||
|
@@ -2,6 +2,7 @@ apiVersion: prometheus.coreos.com/v1alpha1
|
|||||||
kind: Prometheus
|
kind: Prometheus
|
||||||
metadata:
|
metadata:
|
||||||
name: prometheus-frontend
|
name: prometheus-frontend
|
||||||
|
namespace: default
|
||||||
labels:
|
labels:
|
||||||
prometheus: frontend
|
prometheus: frontend
|
||||||
spec:
|
spec:
|
||||||
|
@@ -2,6 +2,7 @@ apiVersion: prometheus.coreos.com/v1alpha1
|
|||||||
kind: ServiceMonitor
|
kind: ServiceMonitor
|
||||||
metadata:
|
metadata:
|
||||||
name: frontend
|
name: frontend
|
||||||
|
namespace: default
|
||||||
labels:
|
labels:
|
||||||
team: frontend
|
team: frontend
|
||||||
spec:
|
spec:
|
||||||
|
Reference in New Issue
Block a user