|
| 1 | +# Install Prometheus-operator steps |
| 2 | + |
| 3 | +Currently, llmaz has already integrated metrics. This document provides deployment steps explaining how to install and configure Prometheus Operator in a Kubernetes cluster. |
| 4 | + |
| 5 | +### Install the prometheus operator |
| 6 | + |
| 7 | +Please follow the [documentation](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/getting-started/installation.md) to install |
| 8 | + |
| 9 | +```bash |
| 10 | +# Installing the prometheus operator |
| 11 | +root@VM-0-5-ubuntu:/home/ubuntu# kubectl get pods |
| 12 | +NAME READY STATUS RESTARTS AGE |
| 13 | +prometheus-operator-55b5c96cf8-jl2nx 1/1 Running 0 12s |
| 14 | +``` |
| 15 | +Ensure that the Prometheus Operator Pod is running successfully. |
| 16 | + |
| 17 | +### Install the ServiceMonitor CR for llmaz |
| 18 | + |
| 19 | +To enable monitoring for the llmaz system, you need to install the ServiceMonitor custom resource (CR). |
| 20 | +You can either modify the Helm chart prometheus according to the [documentation](./../../chart/values.global.yaml) or use `make install-prometheus` in Makefile. |
| 21 | + |
| 22 | +- Using Helm Chart: to modify the values.global.yaml |
| 23 | +```yaml |
| 24 | +prometheus: |
| 25 | + # -- Whether to enable Prometheus metrics exporting. |
| 26 | + enable: true |
| 27 | +``` |
| 28 | +- Using Makefile Command: `make install-prometheus ` |
| 29 | +```bash |
| 30 | +root@VM-0-5-ubuntu:/home/ubuntu/llmaz# make install-prometheus |
| 31 | +kubectl apply --server-side -k config/prometheus |
| 32 | +serviceaccount/llmaz-prometheus serverside-applied |
| 33 | +clusterrole.rbac.authorization.k8s.io/llmaz-prometheus serverside-applied |
| 34 | +clusterrolebinding.rbac.authorization.k8s.io/llmaz-prometheus serverside-applied |
| 35 | +prometheus.monitoring.coreos.com/llmaz-prometheus serverside-applied |
| 36 | +servicemonitor.monitoring.coreos.com/llmaz-controller-manager-metrics-monitor serverside-applied |
| 37 | +``` |
| 38 | + |
| 39 | +### Check Related Resources |
| 40 | + |
| 41 | +Verify that the necessary resources have been created: |
| 42 | + |
| 43 | +- ServiceMonitor |
| 44 | +```bash |
| 45 | +root@VM-0-5-ubuntu:/home/ubuntu/llmaz# kubectl get ServiceMonitor -n llmaz-system |
| 46 | +NAME AGE |
| 47 | +llmaz-controller-manager-metrics-monitor 59s |
| 48 | +``` |
| 49 | +- Prometheus Pods |
| 50 | +```bash |
| 51 | +root@VM-0-5-ubuntu:/home/ubuntu/llmaz# kubectl get pods -n llmaz-system |
| 52 | +NAME READY STATUS RESTARTS AGE |
| 53 | +llmaz-controller-manager-7ff8f7d9bd-vztls 2/2 Running 0 28s |
| 54 | +prometheus-llmaz-prometheus-0 2/2 Running 0 27s |
| 55 | +``` |
| 56 | +- Services |
| 57 | +```bash |
| 58 | +root@VM-0-5-ubuntu:/home/ubuntu/llmaz# kubectl get svc -n llmaz-system |
| 59 | +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE |
| 60 | +llmaz-controller-manager-metrics-service ClusterIP 10.96.79.226 <none> 8443/TCP 46s |
| 61 | +llmaz-webhook-service ClusterIP 10.96.249.226 <none> 443/TCP 46s |
| 62 | +prometheus-operated ClusterIP None <none> 9090/TCP 45s |
| 63 | +``` |
| 64 | + |
| 65 | +### View metrics using the prometheus UI |
| 66 | +Use port forwarding to access the Prometheus UI from your local machine: |
| 67 | + |
| 68 | +```bash |
| 69 | +root@VM-0-5-ubuntu:/home/ubuntu# kubectl port-forward services/prometheus-operated 39090:9090 --address 0.0.0.0 -n llmaz-system |
| 70 | +Forwarding from 0.0.0.0:39090 -> 9090 |
| 71 | +``` |
| 72 | + |
| 73 | +If using kind, we can use port-forward, `kubectl port-forward services/prometheus-operated 39090:9090 --address 0.0.0.0 -n llmaz-system` |
| 74 | +This allows us to access prometheus using a browser: `http://{ecs public IP}:39090/query` |
| 75 | + |
| 76 | + |
0 commit comments