Bạn có thể tham khảo helm chart sau:
https://prometheus-community.github.io/helm-charts

Phần dưới này đã bị outdate
helm repo add stable https://charts.helm.sh/stable
helm search repo prometheus-operator
NAME CHART VERSION APP VERSION DESCRIPTION
stable/prometheus-operator 9.3.2 0.38.1 DEPRECATED Provides easy monitoring definitions...
helm show values stable/prometheus-operator > prometheus-operator.yaml
get password admin grafana:
kubectl get secret --namespace <namespace> <name-deployment-grafana> -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
Nếu bạn đã cài được prometheus thì việc tiếp theo là config như thế nào để monitor được application.
Minh đang có 1 workload là spin-clouddriver bằng 1 số câu lệnh hal config … thì mình đã enable metrics của spinnaker lên được


kubectl -n spin port-forward deployments/spin-clouddriver 8008:8008
Mình sử dụng câu lệnh này để forward port của pod ra laptop để test trước


Tiếp theo là làm sao để prometheus đọc được metrics này.
chúng ta sẽ sửa dụng thằng ServiceMonitor

Referent links:
https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md
https://stackoverflow.com/questions/52991038/how-to-create-a-servicemonitor-for-prometheus-operator
chúng ta có service như sau:
apiVersion: v1
kind: Service
metadata:
labels:
app: spin
cluster: spin-clouddriver
name: spin-clouddriver
namespace: spin
spec:
ports:
- port: 7002
protocol: TCP
targetPort: 7002
selector:
app: spin
cluster: spin-clouddriver
type: ClusterIP
Chúng ta sẽ config port service monitor như sau:
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
release: prometheus-operator
name: spin-clouddriver-metrics
namespace: spin
spec:
endpoints:
- interval: 30s
path: /prometheus_metrics
targetPort: 8008
selector:
matchLabels:
cluster: spin-clouddriver

How Prometheus Operator facilitates Prometheus configuration updates
https://nakamasato.medium.com/how-prometheus-operator-facilitates-prometheus-configuration-updates-a55844186e04