Friday, March 1, 2024

Install Prometheus in Minikube using Helm

To install Prometheus in Minikube using Helm, follow these step-by-step instructions. This process assumes that you already have Minikube and Helm installed.

Prerequisites:

  1. Minikube installed on your machine. Minikube Installation Guide
  2. kubectl installed and configured. kubectl Installation Guide
  3. Helm installed on your machine. Helm Installation Guide

Step-by-Step Installation

Step 1: Start Minikube

Start your Minikube cluster:

 minikube start


Wait for Minikube to start, and check the status:

 minikube status

Step 2: Add Helm Repository for Prometheus

Helm provides a stable repository that contains Prometheus charts. First, add the prometheus-community repository:

 helm repo add prometheus-community https://prometheus-community.github.io/helm-charts

Update your Helm repository to make sure everything is up-to-date:

 helm repo update

Step 3: Create a Namespace for Monitoring

Create a dedicated namespace for Prometheus (e.g., monitoring):

 kubectl create namespace monitoring

Step 4: Install Prometheus Using Helm

Now, use Helm to install Prometheus. You will use the Prometheus chart from the prometheus-community repository.

helm install prometheus prometheus-community/prometheus --namespace monitoring
 

This command will:

  • Install the Prometheus chart from the prometheus-community Helm repo.
  • Use the namespace monitoring for the Prometheus components.

Step 5: Verify the Installation

Check the resources created in the monitoring namespace:

kubectl get all -n monitoring
 

You should see several resources such as pods, services, deployments, statefulsets, etc.

Step 6: Access the Prometheus UI

To access the Prometheus UI, we will use Minikube’s service tunneling feature. Run the following command to get the service URL:

minikube service prometheus-server -n monitoring
 

This will launch a browser window to access Prometheus.

If you want to expose the Prometheus UI via port forwarding, you can run:

helm uninstall prometheus --namespace monitoring
 

You can also delete the monitoring namespace if you no longer need it:

kubectl delete namespace monitoring