4.12 - Lab 13¶
Objectives¶
- Deploy Prometheus
- Configure Grafana
- Deploy Grafana
- Access the Grafana Instance
Deploy Prometheus¶
-
Using the terminal, navigate to the
prometheus
directory.cd ~/Workspace/tkg-extensions-v1.3.1+vmware.1/extensions/monitoring/prometheus
-
Copy the default configuration values file.
cp prometheus-data-values.yaml.example prometheus-data-values.yaml
-
Set the kubectl context to the tkc-01 cluster.
kubectl config use-context tkc-01-admin@tkc-01
-
Create a namespace for the Prometheus service on the Tanzu Kubernetes cluster.
kubectl apply -f namespace-role.yaml
-
Create a Kubernetes secret from the configuration values file.
kubectl create secret generic prometheus-data-values --from-file=values.yaml=prometheus-data-values.yaml -n tanzu-system-monitoring
-
Deploy the Prometheus extension.
kubectl apply -f prometheus-extension.yaml
-
Verify the status of the deployment by using kubectl.
kubectl get app prometheus -n tanzu-system-monitoring
Re-run the command until the status displays as
Reconcile succeeded
. -
Verify the status of the deployment by using kapp.
kapp list -n tanzu-system-monitoring
kapp inspect --app prometheus-ctrl -n tanzu-system-monitoring
Configure Grafana¶
-
Using the terminal, navigate to the
grafana
directory.cd ~/Workspace/tkg-extensions-v1.3.1+vmware.1/extensions/monitoring/grafana
-
Copy the default configuration values file.
cp grafana-data-values.yaml.example grafana-data-values.yaml
-
Create a base64 encoded password.
echo -n "VMware1!" | base64
-
Open
grafana-data-values.yaml
in Visual Studio Code.code grafana-data-values.yaml
-
Modify the following parameters.
The configuration file should resemble the following screenshot.
-
Save the file and close Visual Studio Code.
- Verify that the configuration file matches the reference configuration file.
checkconfig grafana-data-values.yaml
When a configuration mismatch exists, Visual Studio Code opens the configuration file in the left panel and the reference configuration file in the right panel.
-
If a configuration mismatch exists, modify the configuration on the left to match the reference configuration on the right.
Differences are highlighted in red.
-
Save the file and close Visual Studio Code.
-
Deploy Grafana¶
-
Using the terminal, navigate to the
grafana
directory.cd ~/Workspace/tkg-extensions-v1.3.1+vmware.1/extensions/monitoring/grafana
-
Create the namespaces.
kubectl apply -f namespace-role.yaml
-
Create a Kubernetes secret with the configuration values file.
kubectl create secret generic grafana-data-values --from-file=values.yaml=grafana-data-values.yaml -n tanzu-system-monitoring
-
Deploy the Grafana extension.
kubectl apply -f grafana-extension.yaml
-
Verify the status of the deployment by using kubectl.
kubectl get app grafana -n tanzu-system-monitoring
Re-run the command until the status displays as
Reconcile succeeded
. -
Verify the status of the deployment by using kapp.
kapp list -n tanzu-system-monitoring
kapp inspect --app grafana-ctrl -n tanzu-system-monitoring
Access the Grafana Web Interface¶
-
Using Firefox, open the Grafana bookmark in a new tab.
https://grafana.tkg.vclass.local
-
Click Advanced and click Accept the Risk and Continue.
The browser redirects to the Grafana login screen.
-
Log in to Grafana.
- User name: admin
- Password: VMware1!
- In the left navigation panel, click + and click Import.
-
On the Import screen, enter 7249 for Import via grafana.com.
7249 is the ID of a freely available Kubernetes dashboard on Grafana.com
-
Click Load.
The dashboard information displays.
-
For Prometheus, select Prometheus.
-
Click Import.
The imported dashboard displays.