The monitoring and logging solutions described here run on the cluster, so you have to make sure you have enough resources to accommodate their workloads. If you used the recommended configurations in the create cluster section, you should be fine.
To install monitoring using the NFS storage we create previously, follow this guide. You can also refer to the Rancher documentation.
Cluster explorer -> Cluster tools (bottom left)
Click on "install" for the Monitoring app and set the following values:
- Prometheus
- Check "Persistent Storage for Prometheus"
- Storage class name:
nfs-client
- Storage class name:
- Check "Persistent Storage for Prometheus"
- Grafana
- Grafana Storage: Enable with PVC template
- Size:
50Gi
(it doesn't matter what size you choose) - Storage class name:
nfs-client
- Access mode:
ReadWriteOnce
- Size:
- Grafana Storage: Enable with PVC template
- Click on "Edit YAML"
- Set the following under
grafana:
- Set the following under
...
grafana:
initChownData:
enabled: false
...
- Scroll down to
prometheus:
- Scroll down to
prometheusSpec:
- Scroll down to
storageSpec:
- Remove the
selector:
key and all values under it starting withmatch
- Remove the
- Scroll down to
- Scroll down to
You can check the created workloads in cattle-monitoring-system
namespace, pay attention to pending workloads
which might not have enough resources, in that case you will need to increate the amount of resources in your
cluster.
In case of problems you can view and update the app in cluster explorer -> apps -> installed apps.
See the Rancher documentation for more information and usage instructions.
To install logging using the NFS storage we create previously, follow this guide. You can also refer to the Rancher documentation.
The logging architecture will involve 2 services:
- Rancher logging app - handles the aggregation of logs from all cluster workloads
- Grafana Loki - handles the storage of logs and supports searching and displaying them via Grafana
Cluster explorer -> Cluster tools (bottom left)
Click on "install" for the Logging app and accept all the default values.
You can check the created workloads in cattle-logging-system
namespace, pay attention to pending workloads
which might not have enough resources, in that case you will need to increate the amount of resources in your
cluster.
In case of problems you can view and update the app in cluster explorer -> apps -> installed apps.
Cluster explorer -> apps -> Repositories -> Create
- Name:
grafana
- Target: http URL
- Index URL:
https://grafana.github.io/helm-charts
Cluster explorer -> apps -> search for loki
and click on the loki
chart
Click on install (guide was written for Loki chart version 2.13.3 but it should work with newer versions as well)
- namespace:
cattle-logging-system
- Name:
loki
- Edit the YAML:
- Set
persistence.enabled
totrue
- Set
Cluster explorer -> logging -> ClusterOutputs -> create
- Name:
loki
- Output:
loki
- Target URL:
http://loki.cattle-logging-system.svc.cluster.local:3100
Cluster explorer -> logging -> ClusterFlows -> create
- Name:
cluster-to-loki
- Outputs:
loki
Make a few requests to the nginx test app or any other request that will generate logs.
To view the logs (it might take a few minutes until logs are available) -
Cluster explorer -> Monitoring -> Grafana
- Click on sign-in button (bottom left)
- login with user
admin
passwordprom-operator
- Click on configuration (left sidebar) -> data sources -> add datasource
- Type: Loki
- URL:
http://loki.cattle-logging-system.svc.cluster.local:3100
- Click on explore (left sidebar)
- Choose loki data source (top left)
- Click on the log browser link and follow the instructions