Setting Grafana as LoadBalancer in Kubernetes with HiveMQ Operator
In this article, we will guide you through the process of configuring the Grafana service as a LoadBalancer in a Kubernetes cluster using the HiveMQ Operator. By default, Grafana is set to use the node port type, but we will demonstrate how to change it to a LoadBalancer service type to enable external access.
Prerequisites
The Kubernetes cluster is already set up and running on your choice of cloud provider
k8s version 1.16+ is installed
Helm version 3 is installed
The Hivemq k8s operator repo is already added in the helm repo
Instructions
Add the
kube-prometheus-stack
config block in yourvalues.yaml
to set Grafana service type as Loadbalancer. Please refer following example.kube-prometheus-stack: grafana: service: type: LoadBalancer hivemq: monitoring: enabled: true dedicated: true ...
Deploy the changes using the following command
helm upgrade --install -f <your values.yaml> <your deployment name> hivemq/hivemq-operator -n <namespace>
That’s it. To ensure that Grafana's service has been configured as a LoadBalancer and to obtain the external IP for accessing Grafana, execute the following command:
kubectl get services -n <your namespace>