| name | observability-stack |
| description | Observability stack โ deploy Prometheus, Grafana, Loki, and Alertmanager, plus day-2 monitoring operations |
When to Use
- Deploy observability stack (Prometheus, Grafana, Alertmanager)
- Configure monitoring for platform components
- Create and manage Grafana dashboards
- Configure alerting rules and notification channels
- Troubleshoot with metrics and logs
Prerequisites
- kubectl access to target cluster
- Helm 3.12+ installed
- AKS cluster deployed (H1 Foundation)
Installation & Deployment
1. Deploy kube-prometheus-stack
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
kubectl create namespace monitoring
helm install monitoring prometheus-community/kube-prometheus-stack \
--namespace monitoring \
--values deploy/helm/monitoring/values.yaml \
--wait --timeout 15m
kubectl get pods -n monitoring
kubectl wait --for=condition=ready pod -l app.kubernetes.io/instance=monitoring -n monitoring --timeout=600s
2. Deploy Custom Dashboards
kubectl create configmap grafana-dashboards \
--namespace monitoring \
--from-file=grafana/dashboards/ \
--dry-run=client -o yaml | kubectl apply -f -
kubectl label configmap grafana-dashboards \
--namespace monitoring \
grafana_dashboard=1
3. Deploy Custom Alert Rules
kubectl apply -f prometheus/alerting-rules.yaml -n monitoring
kubectl apply -f prometheus/recording-rules.yaml -n monitoring
promtool check rules prometheus/alerting-rules.yaml
promtool check rules prometheus/recording-rules.yaml
4. Verify Installation
kubectl get pods -n monitoring
kubectl port-forward -n monitoring svc/monitoring-grafana 3000:80
kubectl port-forward -n monitoring svc/monitoring-kube-prometheus-prometheus 9090:9090
curl -s http://localhost:9090/api/v1/targets | jq '.data.activeTargets | length'
curl -s -u admin:prom-operator http://localhost:3000/api/datasources | jq '.[].name'
Day-2 Operations
Prometheus Operations
kubectl get pods -n monitoring -l app.kubernetes.io/name=prometheus
kubectl port-forward -n monitoring svc/monitoring-kube-prometheus-prometheus 9090:9090
curl -s http://localhost:9090/api/v1/query?query=up | jq '.data.result'
curl -s http://localhost:9090/api/v1/targets | jq '.data.activeTargets | length'
Grafana Operations
kubectl get pods -n monitoring -l app.kubernetes.io/name=grafana
kubectl port-forward -n monitoring svc/monitoring-grafana 3000:80
curl -s -u admin:prom-operator http://localhost:3000/api/datasources | jq '.[].name'
Alert Management
kubectl get pods -n monitoring -l app.kubernetes.io/name=alertmanager
curl -s http://localhost:9093/api/v2/alerts | jq '.[].labels.alertname'
promtool check rules prometheus/alerting-rules.yaml
Troubleshooting
kubectl logs -n monitoring -l app.kubernetes.io/name=prometheus --tail=100
kubectl logs -n monitoring -l app.kubernetes.io/name=grafana --tail=100
curl -s http://localhost:9090/api/v1/targets | jq '.data.activeTargets[] | select(.health != "up") | {job: .labels.job, health, lastError}'
Project Files Reference
- Helm values:
deploy/helm/monitoring/values.yaml
- Alerting rules:
prometheus/alerting-rules.yaml
- Recording rules:
prometheus/recording-rules.yaml
- Grafana dashboards:
grafana/dashboards/
- Terraform module:
terraform/modules/observability/
Best Practices
- Use ServiceMonitors for scrape configuration
- Set appropriate retention periods (15d default)
- Configure alert routing correctly (PagerDuty for critical, Teams for warning)
- Use recording rules for expensive queries
- Enable persistent storage for Prometheus and Grafana
- Configure Entra ID SSO for Grafana
- Monitor ArgoCD and Backstage scrape targets
Output Format
- Command executed
- Monitoring status summary
- Active alerts if any
- Recommendations
Integration with Agents
Used by: @sre, @devops