Tanzu offers essential cluster monitoring with Prometheus and Grafana through TKG packages. When deployed to a cluster, you have metrics collection and storage, alerting, and dashboards.
Note: This is an in-cluster service. Using this approach, you would have to deploy Prometheus and Grafana to each cluster with individual storage and dashboards for each cluster. Alternatively, Tanzu Observability provides multi-cluster observability and is part of the Tanzu Advanced offering.
In this lab we will be adding monitoring to the management cluster.
The scripts to prepare and execute the YAML to deploy prometheus and grafana depend on a parameters to be set. Ensure the following are set in params.yaml
:
# Leave prometheus-fqdn blank if you choose not to expose it, there is no auth
management-cluster.prometheus-fqdn: prometheus.dragonstone.tkg-vsphere-lab.winterfell.live
# Grafana has auth
management-cluster.grafana-fqdn: grafana.dragonstone.tkg-vsphere-lab.winterfell.live
grafana.admin-password: REDACTED
Prepare the YAML manifests for the related prometheus k8s objects. Manifests will be output into generated/$CLUSTER_NAME/monitoring/
in case you want to inspect.
./scripts/generate-and-apply-prometheus-yaml.sh \
$(yq e .management-cluster.name $PARAMS_YAML) \
$(yq e .management-cluster.prometheus-fqdn $PARAMS_YAML)
- (Using Incognito Window) Access prometheus at the configured
management-cluster.prometheus-fqdn
usinghttps://
- Enter
container_memory_working_set_bytes
into search box - Choose
Graph
for output - Click
Execute
button - View results
open https://$(yq e .management-cluster.prometheus-fqdn $PARAMS_YAML)
Prepare the YAML manifests for the related grafana k8s objects. Manifests will be output into generated/$CLUSTER_NAME/monitoring/
in case you want to inspect.
./scripts/generate-and-apply-grafana-yaml.sh \
$(yq e .management-cluster.name $PARAMS_YAML) \
$(yq e .management-cluster.grafana-fqdn $PARAMS_YAML)
- (Using Incognito Window) Access grafana at the configured
management-cluster.grafana-fqdn
usinghttps://
- Login with username
admin
and the password you specified asgrafana.admin-password
- Now we will import a dashboard. Choose
+
from left menu, thenImport
- Enter
13382
into the Import via grafana.com box, and chooseLoad
- Choose
Prometheus
from thePrometheus
dropdown menu, and then clickImport
- View the dashboard!
open https://$(yq e .management-cluster.grafana-fqdn $PARAMS_YAML)