Apply suggestions from code review

Co-authored-by: Lucas Servén Marín <lserven@gmail.com>
This commit is contained in:
leonnicolas 2021-10-20 22:25:05 +02:00 committed by GitHub
parent edb8f63848
commit bb3554a3c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 14 deletions

View File

@ -242,7 +242,7 @@ website/docs/README.md: README.md
cat README.md >> $@ cat README.md >> $@
cp -r docs/graphs website/static/img/ cp -r docs/graphs website/static/img/
sed -i 's/\.\/docs\///g' $@ sed -i 's/\.\/docs\///g' $@
find $(@D) -type f -name '*.md' | xargs -I{} sed -i 's/\.\/\(.\+\.svg\)/\/img\/\1/g' {} find $(@D) -type f -name '*.md' | xargs -I{} sed -i 's/\.\/\(.\+\.\(svg\|png\)\)/\/img\/\1/g' {}
find $(@D) -type f -name '*.md' | xargs -I{} sed -i 's/\.\/\(.\+\.png\)/\/img\/\1/g' {} find $(@D) -type f -name '*.md' | xargs -I{} sed -i 's/\.\/\(.\+\.png\)/\/img\/\1/g' {}
sed -i 's/graphs\//\/img\/graphs\//g' $@ sed -i 's/graphs\//\/img\/graphs\//g' $@
# The next line is a workaround until mdx, docusaurus' markdown parser, can parse links with preceding brackets. # The next line is a workaround until mdx, docusaurus' markdown parser, can parse links with preceding brackets.

View File

@ -4,7 +4,7 @@ The following assumes that you have applied the [kube-prometheus](https://github
## Kilo ## Kilo
Monitor the Kilo daemon set with: Monitor the Kilo DaemonSet with:
```shell ```shell
kubectl apply -f https://raw.githubusercontent.com/squat/kilo/main/manifests/podmonitor.yaml kubectl apply -f https://raw.githubusercontent.com/squat/kilo/main/manifests/podmonitor.yaml
``` ```
@ -17,12 +17,12 @@ kubectl create ns kilo
kubectl apply -f https://raw.githubusercontent.com/squat/kilo/main/manifests/wg-exporter.yaml kubectl apply -f https://raw.githubusercontent.com/squat/kilo/main/manifests/wg-exporter.yaml
``` ```
The manifest will deploy [Prometheus WireGuard Exporter](https://github.com/MindFlavor/prometheus_wireguard_exporter) as a daemon set and a [podmonitor](https://docs.openshift.com/container-platform/4.8/rest_api/monitoring_apis/podmonitor-monitoring-coreos-com-v1.html). The manifest will deploy the [Prometheus WireGuard Exporter](https://github.com/MindFlavor/prometheus_wireguard_exporter) as a DaemonSet and a [PodMonitor](https://docs.openshift.com/container-platform/4.8/rest_api/monitoring_apis/podmonitor-monitoring-coreos-com-v1.html).
By default kube-prometheus will only monitor the default, kube-system and monitoring namespaces. By default the kube-prometheus stack only monitors the `default`, `kube-system` and `monitoring` namespaces.
In order to allow prometheus-k8s to monitor the kilo namespace, apply the Role and RoleBinding with: In order to allow Prometheus to monitor the `kilo` namespace, apply the Role and RoleBinding with:
```shell ```shell
kubectl apply -f kubectl apply -f https://raw.githubusercontent.com/squat/kilo/main/manifests/wg-exporter-role-kube-prometheus.yaml kubectl apply -f https://raw.githubusercontent.com/squat/kilo/main/manifests/wg-exporter-role-kube-prometheus.yaml
``` ```
## Metrics ## Metrics
@ -30,7 +30,7 @@ kubectl apply -f kubectl apply -f https://raw.githubusercontent.com/squat/kilo/m
### Kilo ### Kilo
Kilo exports some standard metrics with the Prometheus GoCollector and ProcessCollector. Kilo exports some standard metrics with the Prometheus GoCollector and ProcessCollector.
It also exposes some Kilo specific metrics. It also exposes some Kilo-specific metrics.
``` ```
# HELP kilo_errors_total Number of errors that occurred while administering the mesh. # HELP kilo_errors_total Number of errors that occurred while administering the mesh.
@ -66,23 +66,23 @@ The [Prometheus WireGuard Exporter](https://github.com/MindFlavor/prometheus_wir
## Display some Metrics ## Display some Metrics
If your laptop is a Kilo peer of the cluster you can navigate you browser directly to the service IP of prometheus-k8s. If your laptop is a Kilo peer of the cluster you can access the Prometheus UI by navigating your browser directly to the cluster IP of the `prometheus-k8s` service.
Otherwise use `port-forward`: Otherwise use `port-forward`:
```shell ```shell
kubectl -n monitoring port-forward svc/prometheus-k8s 9090 kubectl -n monitoring port-forward svc/prometheus-k8s 9090
``` ```
and navigate your browser to `localhost:9090`. and navigate your browser to `localhost:9090`.
Check if you can see the podmonitor of Kilo and the WireGuard Exporter under **Status** -> **Targets** in the web frontend. Check if you can see the PodMonitors for Kilo and the WireGuard Exporter under **Status** -> **Targets** in the Prometheus web UI.
If you don't see them, check the logs of the `prometheus-k8s` pods, maybe they don't have the permission to get the pods in their namespaces. If you don't see them, check the logs of the `prometheus-k8s` Pods; it may be that Prometheus doesn't have the permission to get Pods in the `kilo` namespace.
In this case, you need to apply the Role and RoleBinding from above. In this case, you need to apply the Role and RoleBinding from above.
Navigate to **Graph** and try to execute a simple query, eg. type `kilo_nodes` and klick execute. Navigate to **Graph** and try to execute a simple query, e.g. type `kilo_nodes` and click on `execute`.
You should see some data. You should see some data.
## Using Grafana ## Using Grafana
Let't navigate to the Grafana dashboard. Let's navigate to the Grafana dashboard.
Again, if your laptop is not a Kilo peer, use `port-forward`: Again, if your laptop is not a Kilo peer, use `port-forward`:
```shell ```shell
kubectl -n monitoring port-forward svc/grafana 3000 kubectl -n monitoring port-forward svc/grafana 3000
@ -91,8 +91,8 @@ kubectl -n monitoring port-forward svc/grafana 3000
Now navigate your browser to `localhost:3000`. Now navigate your browser to `localhost:3000`.
The default user and password is `admin` `admin`. The default user and password is `admin` `admin`.
There is an example configuration for a dashboard [here](https://raw.githubusercontent.com/squat/kilo/main/docs/grafana/kilo.json). An example configuration for a dashboard displaying Kilo metrics can be found [here](https://raw.githubusercontent.com/squat/kilo/main/docs/grafana/kilo.json).
You can import this dashboard if you hit **+** -> **Import** on the Grafana dashboard. You can import this dashboard by hitting **+** -> **Import** on the Grafana dashboard.
The dashboard looks like this: The dashboard looks like this: