Helm chart deployment for monitoring stack¶
The Helm chart deployment for monitoring stack refers to the process of installing and managing observability tools—specifically Prometheus and Grafana—on a Kubernetes cluster using Helm charts.^[400-devops__03-Containerization__prometheus.md]
Prometheus Deployment¶
Prometheus can be deployed using the official chart maintained by the prometheus-community. The process involves adding the community Helm repository and updating the local repository index before installation.^[400-devops__03-Containerization__prometheus.md]
The standard installation command deploys the Prometheus server, Alertmanager, and several other components, including kube-state-metrics and node-exporter.^[400-devops__03-Containerization__prometheus.md]
Installation Commands¶
To deploy the stack, the following sequence of Helm commands is typically used:^[400-devops__03-Containerization__prometheus.md]
[Helm](<./helm.md>) repo add prometheus-community https://prometheus-community.github.io/helm-charts
[Helm](<./helm.md>) repo update
[Helm](<./helm.md>) install [Prometheus](<./prometheus.md>) prometheus-community/[Prometheus](<./prometheus.md>)
Upon deployment, the Helm release generates several pods. A typical deployment includes containers for the Alertmanager, Kube-State-Metrics, Node Exporter, Pushgateway, and the Prometheus Server itself.^[400-devops__03-Containerization__prometheus.md]
Accessing Services¶
After installation, the services are accessed internally via Kubernetes DNS. For example, the Prometheus server is available at prometheus-server.default.svc.cluster.local.^[400-devops__03-Containerization__prometheus.md]
To interact with these services from a local machine, kubectl port-forward is used to map a local port to the target Pod.^[400-devops__03-Containerization__prometheus.md]
Port Forwarding¶
- Prometheus Server: Forward local port
9090to the server Pod.^[400-devops__03-Containerization__prometheus.md] - Alertmanager: Forward local port
9093to the alertmanager Pod.^[400-devops__03-Containerization__prometheus.md] - Pushgateway: Forward local port
9091to the pushgateway Pod.^[400-devops__03-Containerization__prometheus.md]
Grafana Deployment¶
Grafana is typically deployed alongside Prometheus to visualize Metrics. This is done using the official Grafana community Helm chart.^[400-devops__03-Containerization__prometheus.md]
Installation and Credentials¶
The Grafana chart is installed into the default namespace.^[400-devops__03-Containerization__prometheus.md]
A critical post-installation step is retrieving the default administrative password, which is stored as a Kubernetes Secret. The password can be extracted and decoded using kubectl and base64.^[400-devops__03-Containerization__prometheus.md]
[kubectl](<./kubectl.md>) get secret --namespace default [Grafana](<./grafana.md>) -o jsonpath="{.data.admin-password}" | base64 --decode
Once the password is retrieved, the Grafana UI can be accessed locally by forwarding port 3000.^[400-devops__03-Containerization__prometheus.md]
Data Source Configuration¶
To display Metrics, Grafana must be configured to connect to the Prometheus instance. Within the cluster, Prometheus is reachable via its internal Service DNS (e.g., http://prometheus-server:80 or http://10.111.94.209:80).^[400-devops__03-Containerization__prometheus.md]
Users can then import pre-built dashboards—for example, ID 6417—to monitor the cluster and the deployed applications.^[400-devops__03-Containerization__prometheus.md]
Sources¶
^[400-devops__03-Containerization__prometheus.md]