Running Kubernetes locally on Windows via WSL 2 can sometimes throw networking curveballs—especially when trying to connect your host browser to cluster services. This guide walks through the exact sequence to spin up Minikube, deploy Prometheus and Grafana via Helm, fix local port-forwarding errors, and visualize live cluster metrics.
Step 1: Initialize Your Minikube Cluster
First, ensure your local environment has enough resources allocated to handle containerized monitoring tools like Prometheus and Grafana. Fire up your WSL 2 terminal and start Minikube with increased CPU and memory:
minikube start --cpus=4 --memory=4096
Step 2: Create a Dedicated Monitoring Namespace
Instead of cluttering your default namespace, keep your observability stack organized in its own namespace:
Step 3: Deploy Prometheus & Grafana Using Helm
Add the official Prometheus community Helm repository and install both Prometheus (the metrics database and scraper) and Grafana (the visualization dashboard) directly into your monitoring namespace:
# Add and update the Helm repohelm repo add prometheus-community https://prometheus-community.github.io/helm-chartshelm repo update# Install Prometheus and Grafana
helm install prometheus prometheus-community/prometheus --namespace monitoring
helm install grafana grafana-community/grafana --namespace monitoring
Step 4: Handle the Port-Forwarding Error & Apply the Fix
The Problem
To view Grafana in your web browser, you might normally try standard Kubernetes port forwarding:
The Error: You will likely hit a Connection Refused or socket reset error. Because Minikube runs inside an isolated container network sandbox within WSL 2 and Docker Desktop, host-level port forwarding fails to bridge the virtualization boundary properly.
The Fix
Bypass kubectl port-forward entirely by using Minikube's native service routing bridge:
This command automatically opens a stable tunnel and provides a direct, accessible URL on your local machine (e.g., [http://127.0.0.1](http://127.0.0.1):xxxxx) that your Windows web browser can reach without dropping connections.
Step 5: Log Into Grafana and Connect Prometheus
Open the URL provided by the
minikube servicecommand in your browser.Retrieve your admin password by running this command in your terminal:
kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echoLog into Grafana using username
adminand the decoded password.Go to Data Sources and click Add data source -> Prometheus.
Crucial FQDN Setting: Do not use
http://localhost:9090(which causes an internal container loop error). Instead, use the internal Kubernetes CoreDNS service address:Plaintexthttp://prometheus-server.monitoring.svc.cluster.localClick Save & test. You should see the success confirmation: "Successfully queried the Prometheus API".
Step 6: Import the Kubernetes Overview Dashboard
In Grafana, navigate to the sidebar and click Dashboards -> New -> Import.
Enter the community dashboard ID:
14623(Kubernetes Monitoring Overview) and click Load.At the bottom of the screen, select your newly linked Prometheus data source from the dropdown menu.
Click Import.
Your dashboard will instantly populate with real-time graphs tracking your cluster's CPU utilization, memory usage, node health, and active pod lifecycles!




