This guide provides an example metrics setup.
- Setup port forwarding from the kubernetes cluster's Prometheus instance to your machine.
- Setup and run a grafana server to talk to the cluster.
- A coolbeans & beanstalkd service running on kubernetes.
Apply the Prometheus config map and the deployment yaml
kubectl apply -f k8s/prometheus/0-configmap.yaml
kubectl apply -f k8s/prometheus/1-deployment.yaml
We will use kubernetes port forwarding to forward requests to the tcp port of the Prometheus service
Query via kubectl to get the port address of the beanstalkd proxy
kubectl -n coolbeans get service prometheus
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
prometheus ClusterIP 10.200.12.203 <none> 9090/TCP 26m
Use kubectl port-forward using the service resource name to port forward to.
kubectl -n coolbeans port-forward service/prometheus 9090:9090
Forwarding from 127.0.0.1:9090 -> 9090
Forwarding from [::1]:9090 -> 9090
Handling connection for 9090
Handling connection for 9090
Open http://localhost:9090/ in a browser window, and check to see if the Prometheus web console shows up.
On your local machine, you can view the metrics via Grafana.
Here are the steps to configure a local Grafana instance.
-
Download & install Grafana. You can find more information from the Grafana installation page.
-
Once you have Grafana installed, create a new Prometheus datasource with the HTTP url set to
http://localhost:9090
-
Import this dashboard
-
Below is an sample metrics dashboard