Prometheus on Docker-On-Mac

Suchit Gupta
2 min readFeb 25, 2021

--

A step by step guide to set up a prometheus server on local K8 cluster

Please go through my earlier post to set up the K8 and K8 Dashboard on Docker-On-Mac

Install the helm chart

We will use kube-prometheus-stack helm chart for getting Prometheus server running on our Docker-On-Mac.

Add the repo

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

Update the repo

helm repo update

Install the chart

helm install prometheus prometheus-community/kube-prometheus-stack
Output

Check the pods

kubectl get pods
Output

Check the services

kubectl get svc
output

Expose the Prometheus and Grafana servers from localhost

Save the below manifest file in a file say prometheus-service.yaml and save it inside a folder name prometheus.

apiVersion: v1
kind: Service
metadata:
name: prometheus
spec:
type: NodePort
ports:
- name: web
nodePort: 30900
port: 9090
protocol: TCP
targetPort: web
selector:
prometheus: prometheus-kube-prometheus-prometheus

---
apiVersion: v1
kind: Service
metadata:
name: grafana
spec:
type: NodePort
ports:
- name: service
nodePort: 30901
port: 80
protocol: TCP
targetPort: 3000
selector:
app.kubernetes.io/name: grafana

Execute:

kubectl apply -f prometheus/prometheus-service.yaml

The prometheus server can now be accessed via http://localhost:30900/ and grafana at http://localhost:30901/?orgId=1

Grafana username/password is admin/prom-operator

Check out my another post on how to create a custom resource monitors

https://suchit-g.medium.com/spark-with-prometheus-monitoring-2f91e1208eed

--

--

No responses yet