# Part 6: Observability stack setup to monitor

*   ## **How to monitor EKS cluster, Kubernetes components, and workloads using Prometheus and Grafana via HELM (on the master machine)**
    
*   ### Install Helm Chart
    

```bash
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
```

*   **Add Helm Stable Charts for Your Local Client**
    

```bash
helm repo add stable https://charts.helm.sh/stable
```

*   **Add Prometheus Helm Repository**
    

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

*   ### Create Prometheus Namespace
    

```bash
kubectl create namespace prometheus
kubectl get ns
```

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/6dc42bbc-4407-4412-b34e-70aacb862b8a.png align="center")

*   Install Prometheus using Helm
    

```bash
helm install stable prometheus-community/kube-prometheus-stack -n prometheus
```

*   Verify Prometheus installation
    

```bash
kubectl get pods -n prometheus
```

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/04ddb757-4143-45b6-973c-567ac92313fc.png align="center")

*   **Check the services file (svc) of the Prometheus**
    

```plaintext
kubectl get svc -n prometheus
```

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/f7c3d438-ff0b-4f0f-ac2a-63314316d8b7.png align="center")

*   **Expose Prometheus and Grafana to the external world through Node Port**
    

> ***\[Note\] change it from Cluster IP to NodePort after changing make sure you save the file and open the assigned nodeport to the service.***

```bash
kubectl edit svc/stable-kube-prometheus-sta-prometheus -n prometheus
```

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/83a91c9b-8d44-4b8f-bae3-34b8dd33a019.png align="center")

**Verify service**

```bash
kubectl get svc -n prometheus
```

*   **Now, let’s change the SVC file of Grafana and expose it to the outer world**
    

```bash
kubectl edit svc stable-grafana -n prometheus
```

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/683c26f6-ed6a-441e-9626-1b5849d570ad.png align="center")

*   **Check the Grafana service**
    

```bash
kubectl get svc -n prometheus
```

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/b7995261-2aa0-4009-bc45-2356bdf0bd9b.png align="center")

*   **Access the Grafana with** `<public-ip-of-master>:32108` **and Prometheus with** `<public-ip-of-master>:31521`
    

> Note - First port-forward through the below command:

```plaintext
kubectl port-forward svc/stable-grafana 32108:80 -n prometheus --address 0.0.0.0 &

kubectl port-forward svc/stable-kube-prometheus-sta-prometheus 31521:9090 -n prometheus --address 0.0.0.0 &
```

*   **Prometheus:**
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/35e4dbdb-ad12-4dc1-a902-b8acbe31a629.png align="center")

*   **Get a password for Grafana**
    

> \[Note\] Username: admin

```plaintext
kubectl get secret --namespace prometheus stable-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
```

*   **Now, view the Dashboard in Grafana**
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/44030b15-1525-4ede-b727-1468ec5b3e7a.png align="center")

*   **Click on Dashboards**
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/29142bfc-5ea9-4ac7-a591-8543bbf958f7.png align="center")

*   **Put the Data Source: Prometheus and Namespace: wanderlust and run for the last 5 minutes.**
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/da472d40-df57-442c-af6c-e1d69228eb82.png align="center")

*   **Custom dashboard by searching on** [**google.com**](http://google.com)
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/04e86853-1eb6-4a76-976f-6670c49976cb.png align="center")

*   **Select anything you liked! and copy the ID**
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/8f412c00-216b-4f22-b759-8ffd8545c2ac.png align="center")

*   Import
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/2952c239-86c4-4ce7-8a0a-6f51bfddcc53.png align="center")

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/b9657187-12f1-4074-946e-8070798a1050.png align="center")

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/650ab50d-9cbf-4082-ba17-58238b11006a.png align="center")

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/004f5072-ef01-4a0e-ba45-12030394968e.png align="center")

Finish!!!

If you managed to follow all the parts and implemented all the steps sucessfully then it's time to celebrate because its most demanding skills in Market

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/5c5940b0-bf9a-4229-98ee-5ca2a2ec9f3c.png align="center")

* * *
