This KB article is written to provide instructions for moving Grafana as a package install (PKGI) on a vSphere Kubernetes cluster to a Helm deployment.
Please note that this KB article does not apply to Grafana as a Supervisor service.
The grafana package is removed in the VKS Standard Package Repository v1.23.
It is recommended to move Grafana to a Helm deployment prior to using the v1.23 VKS Standard Package Repository.
Workload Cluster using VKS standard packages v1.22 and earlier
The Grafana package was removed from the VKS Standard Package Repository starting in VKS-Standard-Packages version v1.23.
Each dashboard will need to be exported individually.
"datasource": {"type":"prometheus","uid":"a1b23cde-4567-8fg9-h011-i1j2k3l4m5n6""type":"prometheus"},
"datasource": {"type":"prometheus","uid":"a1b23cde-4567-8fg9-h011-i1j2k3l4m5n6""type":"prometheus"},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid":"a1b23cde-4567-8fg9-h011-i1j2k3l4m5n6"
"type": "prometheus"
},
"refId": "A"
}
Connect to the vSphere Kubernetes cluster context where the Grafana PKGI is installed
Delete the Grafana PKGI using the tanzu CLI:
tanzu package installed list
tanzu package installed delete <grafana package name> -y
tanzu package installed list
kubectl get all -n <grafana package namespace>
service:
enabled: true
type: NodePort
kubectl get sc -A
persistence:type: pvcenabled:truestorageClassName: CHANGE-MEaccessModes:- ReadWriteOncesize: 10Gi
datasources:datasources.yaml:apiVersion:1datasources:- name: Prometheustype: prometheusurl: http://prometheus-server.tanzu-system-monitoring.svc.cluster.localaccess: proxyisDefault:truedatasources:enabled:true
kubectl create namespace <grafana-namespace-name>
kubectl label ns <grafana-namespace-name> pod-security.kubernetes.io/enforce=privileged
helm install <grafana chart name> grafana/grafana --namespace <grafana-namespace-name> --values values.yaml
helm install: Installs the chart by deploying it on the Kubernetes cluster
<grafana chart name>: The logical chart name that you provided
grafana/grafana: The repository and package name to install
--namespace: The Kubernetes namespace (<grafana-namespace-name>) where you want to deploy the chart
--values: The YAML file to pull values from
helm list -n <grafana-namespace-name>
kubectl get all -n <grafana-namespace-name>
helm get notes <grafana chart name> -n <grafana-namespace-name>
kubectl get secret --namespace <grafana-namespace-name> <grafana chart name> -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
export NODE_PORT=$(kubectl get --namespace <grafana-namespace-name> -o jsonpath="{.spec.ports[0].nodePort}" services <grafana chart name>)
export NODE_IP=$(kubectl get nodes --namespace <grafana-namespace-name> -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
If the VKS Standard Package is upgraded to v1.23 before migrating Grafana PKGI into a Helm deployment, the Grafana PKGI will be in Reconcile Failed state.
Grafana can be re-installed through Helm using default values initially then later configured with the edited values.yaml through the following steps:
kubectl create namespace <grafana-namespace-name>
kubectl get ns
helm search repo grafana/grafana
helm install <grafana chart name> grafana/grafana --namespace <grafana-namespace-name> --version <chart version>
Explanation of arguments:
helm install: Installs the chart by deploying it on the Kubernetes cluster
<grafana chart name>: The logical chart name that you provided
grafana/grafana: The repository and package name to install
--namespace: The Kubernetes namespace (<grafana-namespace-name>) where you want to deploy the chart
--version string: Specify a version constraint for the chart version to use. This constraint can be a specific tag (e.g. 1.1.1) or it may reference a valid range (e.g. ^2.0.0). If this is not specified, the latest version is used
helm list -n <grafana-namespace-name>
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
<grafana chart name> <grafana-namespace-name> 1 YYYY-MM-DD HH:MM:SS +0000 UTC deployed grafana-X.X.X XX.X.X
kubectl get all -n <grafana-namespace-name>
helm upgrade <grafana chart name> grafana/grafana -f values.yaml -n <grafana-namespace-name>