Deploy Grafana using Helm Chart

Ayan Bhadury
2 min readJul 7, 2022

--

Grafana helm chart will help you to configure all its dependencies which makes it ready to ship instances using Kubernetes.

Download helm from here I used homebrew to install it.

brew install helm

Initialize the grafana helm chart repository

helm repo add grafana https://grafana.github.io/helm-charts
helm repo update

Pull the repo to your local system

helm pull grafana/grafana

This will download the grafana version in zip format, the next step would be to unzip the package.

Edit the values.yaml

If you want to customize the grafana config or let's say run OSS/Enterprise build with a specific version you can do it from here.

Install Helm Chart with the updated values.yaml file

To apply the changes you need to use the command below

helm install <name> ./grafana -f ./grafana/values.yaml

Note: Here ./grafana means the grafana extracted folder.

Creating the Pod & its components

The above command will generate an output similar to the below -

NAME: helmgrafanaLAST DEPLOYED: Mon Jul  4 23:11:47 2022NAMESPACE: defaultSTATUS: deployedREVISION: 1NOTES:1. Get your 'admin' user password by running:kubectl get secret --namespace default helmgrafana-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo2. The Grafana server can be accessed via port 80 on the following DNS name from within your cluster:my-release-grafana.default.svc.cluster.localGet the Grafana URL to visit by running these commands in the same shell:export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=helmgrafana" -o jsonpath="{.items[0].metadata.name}")kubectl --namespace default port-forward $POD_NAME 30003. Login with the password from step 1 and the username: admin

Next Steps

1- Generate the password base64 token as mentioned in point 1 above

2- Finally port forward the pod & expose it to your localhost

export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=helmgrafana" -o jsonpath="{.items[0].metadata.name}")kubectl --namespace default port-forward $POD_NAME 3000

3- Use kubectl get pods to confirm the changes.

The final result

If everything is done you would see grafana running on localhost:3000

Grafana server configuration

--

--