Reading Time: 3 mins
Overview
Prometheus is an open-source systems monitoring and alerting toolkit. Tanzu Kubernetes Grid includes signed binaries for Prometheus that you can deploy on Tanzu Kubernetes clusters to monitor cluster health and services. In this post, I will explain the steps to deploy Prometheus on a Tanzu Kubernetes (workload) cluster. For more detailed, refer to official doc
Pre reqs:
- Bootstrap machine with the following installed: Tanzu CLI, kubectl installed as mentioned here
- Tanzu Kubernetes Grid management cluster and workload cluster running on vSphere, Amazon EC2, or Azure, with the package repository installed. For this demo, I have deployed TKG on Azure.
- Cert-manager: click here to get the detailed steps to install cert-manager packages from TMC
- Contour: click here to get the detailed steps to install Contour packages from TMC
Prepare config file:
- Create a yaml file with below config. In this demo, I will be using nodes local storage
- Edit the generated config file: prometheus-data-values.yaml to change the values as shown below.
- Ex: I have changed the domain to prometheus.workshop.captainvirtualization.in and added certificates, key
- Under Alert Manager Service configuration: Provide storageClassName, this should be the same as we mentioned in above storageclass.yaml file.
- Under Prometheus service configuration: Provide storageClassName, this should be the same as we mentioned in above storageclass.yaml file and change the storage to “10Gi”.
- Create two persistent volumes.
-
- Prometheus service configuration
- Alert Manager service configuration
Note: Login to worker node(s) of workload cluster and create empty directory pv1, pv2 under /data/volumes/ and also provide the host name(s) under values in below file.
Install prometheus
- Collect the External IP of envoy load balancer
- Create a DNS record in hosted zone or local host file (/etc/hosts), by mapping the fqdn provided in prometheus-data-values.yaml to above load balancer IP.
- Access the prometheus fqdn in browser