Deploying Prometheus-Operator on Kubernetes with Helm 3
Version compatibility dictates that Kubernetes clusters must run at least version 1.8.0 when deploying Prometheus Operator releases newer than 0.18.0. For new deployments, always prefer the most recent stable release. If migrating from an older stack, upgrade the container orchestration platform before updating the monitoring operator to avoid dependency conflicts.
Obtaining and Configuring the Package Manager
Download the appropriate binary archive for your system architecture from the official distribution channels. Extract the package and relocate the executable to a directory within your system PATH.
tar -xzf helm-v3.9.0-linux-amd64.tar.gz
mv linux-amd64/helm /usr/local/bin/helm
helm version
Once installed, register the official chart repository to access pre-packagde manifests.
helm repo add stable https://charts.helm.sh/stable
helm repo update
Provisioning the Monitoring Namespace
Isolate monitoring components into a dedicated cluster namespace to streamline permission boundaries and resource tracking.
kubectl create namespace ops-monitoring
Retrieve available chart metadata to verify the target version before deployment.
helm search repo prometheus-operator
Applying the Operator Chart
Initialize the monitoring stack using a custom release identifier. This command pulls the necessary Custom Resource Definitions (CRDs), controllers, and default configurations.
helm install prom-stack stable/prometheus-operator \
--namespace ops-monitoring
Verify pod readiness and service exposure by inspecting the allocated workloads.
kubectl get pods,svc -n ops-monitoring
Exposing Dashboard Interfaces
The default service type restricts external traffic to ClusterIP. Bridge this gap by either mapping host ports or routing through an ingress controller.
NodePort Configuration Directly modify the service specification to open cluster nodes for port forwarding.
kubectl patch svc prom-stack-prometheus -n ops-monitoring \
-p '{"spec":{"type":"NodePort"}}'
Ingress Routing (Recommended) Implement reverse proxy rules to maintain flexibility during subsequent updates.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: prometheus-proxy
namespace: ops-monitoring
spec:
rules:
- host: metrics.internal.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: prom-stack-prometheus
port:
number: 9090
Apply the configuration and update local DNS resolution files accordingly.
kubectl apply -f prometheus-ingress.yaml
Configuring Visualization Frontend
Similar to the metrics collector, adjust the visualization service topology.
kubectl patch svc prom-stack-grafana -n ops-monitoring \
-p '{"spec":{"type":"NodePort"}}'
Alternatively, provision an independent ingress entry pointing to port 80. Default authentication credentials are typically set to admin and prom-operator. Access the dashboard panel to configure data sources and import community dashboards.
Evnironment Teardown
Remove all deployed resources and release associated cluster state.
helm uninstall prom-stack -n ops-monitoring
kubectl delete ns ops-monitoring