Follow these instructions to install Grafana on a TKG Service cluster that is running TKr for vSphere 8.x.

Prerequisites

Create Grafana Data Values

Prepare to install Grafana by creating the data values file.

  1. Get the latest Prometheus package version for your repository.
    tanzu package available get grafana.tanzu.vmware.com -n tkg-system

    Or, using kubectl.

    kubectl -n tkg-system get packages | grep grafana
    Note: Typically you should use the latest version unless your requirements differ.
  2. Generate the prometheus-data-values.yaml file.
    tanzu package available get grafana.tanzu.vmware.com/10.0.1+vmware.1-tkg.2 --default-values-file-output grafana-data-values.yaml
    Where:
    • 10.0.1+vmware.1-tkg.2 is the target package version
    • grafana-data-values.yaml is the name and path of the data values file to generate
  3. Edit the gafana-data-values.yaml file and update the values.

    Add the ingress.pvc: storageClassName and its value, which is the name of the vSphere storage class accessible by the TKG cluster.

    To avoid a common error, remove the secret from the data values file and manually create the secret. See Troubleshoot Grafana Installation.

    Here is a minimal gafana-data-values.yaml with the storage class field added and the secret removed. See Grafana Package Reference for an additional example and full list of parameters.
    grafana:
      deployment:
        replicas: 1
        updateStrategy: Recreate
      pvc:
        accessMode: ReadWriteOnce
        storage: 2Gi
      service:
        port: 80
        targetPort: 3000
        type: LoadBalancer
    ingress:
      enabled: true
      prefix: /
      servicePort: 80
      virtual_host_fqdn: grafana.system.tanzu
      pvc:
        storageClassName: vSphere-storage-profile
    namespace: grafana
    

Install Grafana

Complete these steps to install the Grafana package.
  1. Create the namespace for Grafana.
    kubectl create ns tanzu-system-dashboards
  2. Install the Grafana package.
    tanzu package install grafana -p grafana.tanzu.vmware.com -v 10.0.1+vmware.1-tkg.2 --values-file grafana-data-values.yaml -n tanzu-system-dashboards
  3. Verify Grafana installation.
    tanzu package installed list -n tanzu-system-dashboards
    tanzu package installed get grafana -n tanzu-system-dashboards
  4. Verify Grafana objects.
    kubectl -n tanzu-system-dashboards get all
  5. Verify the persistent volume claim held by Grafana.
    kubectl -n tanzu-system-dashboards get pvc

Troubleshoot Grafana Installation

To avoid the error "Secret not created when installing Grafana from default YAML file," remove the grafana.secret.* from the grafana-data-values.yaml and manually create the secret as follows. Then, redeploy the Grafana package.
kubectl create secret generic grafana -n tanzu-system-dashboards  --from-literal=admin=admin