Skip to content

Latest commit

 

History

History
146 lines (98 loc) · 2.79 KB

File metadata and controls

146 lines (98 loc) · 2.79 KB

Prometheus + Alertmanager on EKS (Clean Setup with gp2)

Phase 1: Cleanup Everything to Initial EKS State

1. Uninstall Prometheus Helm Release and Namespace

helm uninstall prometheus -n monitoring || true
kubectl delete ns monitoring --grace-period=0 --force || true

2. Delete Existing PVCs Related to Prometheus

kubectl get pvc -A | grep prometheus | awk '{print $2, $1}' | while read pvc ns; do
  kubectl delete pvc "$pvc" -n "$ns" --grace-period=0 --force || true

done

3. Delete gp3 StorageClass (If Exists)

kubectl delete storageclass gp3 --ignore-not-found

4. Make gp2 the Default StorageClass

kubectl patch storageclass gp2 -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

5. Validate Initial Clean State

kubectl get sc
kubectl get ns | grep monitoring
kubectl get pvc -A

Expected:

  • Only gp2 (default) in storage class.
  • No monitoring namespace or PVCs related to Prometheus.

Phase 2: Fresh Prometheus & Alertmanager Setup

6. Create Monitoring Namespace

kubectl create ns monitoring

7. Create values.yaml File (Do Not Set storageClass Explicitly)

cat <<EOF > values.yaml
server:
  persistentVolume:
    enabled: true
    size: 8Gi

alertmanager:
  enabled: true
  persistentVolume:
    enabled: true
    size: 2Gi
    mountPath: /data
EOF

8. Add and Update Prometheus Helm Repo

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

helm search repo prometheus-community # --> to list the all charts

helm template prometheus-community/prometheus  #--> It will what k8s objects will deploy through chart

9. Install Prometheus with Helm

helm upgrade --install prometheus prometheus-community/prometheus \
  -n monitoring \
  -f values.yaml

Phase 3: Verify Everything is Working

10. Check Pods and PVCs

kubectl get all -n monitoring
kubectl get pvc -n monitoring
kubectl get sc

Expected Output:

  • All Prometheus and Alertmanager pods should be Running
  • PVCs for both prometheus-server and alertmanager should be Bound
  • Storage class in use should be gp2

Phase 4: Access the Web Interfaces

Access Prometheus UI

# change ClusterIp to LoadBalancer
kubectl edit svc <svcName> -n <ns>

Access Alertmanager UI

# change ClusterIp to LoadBalancer
kubectl edit svc <svcName> -n <ns>

Final Success Checklist

Resource Status
StorageClass gp2 (default)
Prometheus PVC Bound
Alertmanager PVC Bound
Prometheus Pod Running
Alertmanager Pod Running