I am running my services on EKS clusters. In order to collect the application metrics [API response times, status and number of calls], I came across Prometheus. There are following steps that I think needs to be done:
- Cluster role, Service account and role binding: this will allow my prometheus service to talk to the cluster nods, pods and services [defined in the resources section].
- Configmap: this allows the scraping process and defines different roles.
- Service and ingress: to establish the endpoints [e.g.: 9090] and routes the traffic from internet.
I came across prometheus using helm which describes how we can make use of helm predefined prometheus charts in order to get the raw metrics from kubernetes.
I followed the steps:
kubectl create namespace prometheus
helm install prometheus stable/prometheus \
--namespace prometheus \
--set alertmanager.persistentVolume.storageClass="gp2",server.persistentVolume.storageClass="gp2"
kubectl get pods -n prometheus
I can see the pods running with that namespace. Now, I have two questions,
- I am having multiple services (For example, service A and service B) running on the cluster. So, how can I distinguish the metrics on Prometheus.
- Do I need to run
kubectl --namespace=prometheus port-forward deploy/prometheus-server 9090
everytime to see the results? I see targetPort is defined as9090
then why do I need to run the command? Can I justvalues.yaml
instead?