From 783cd78c4976b31f2478ca1c149615e99df6029f Mon Sep 17 00:00:00 2001 From: yandongxiao Date: Thu, 13 Jun 2024 17:00:51 +0800 Subject: [PATCH] [Documentation] Update prometheus and grafana related doc (#543) Signed-off-by: yandongxiao --- doc/integration/deploy-prometheus-grafana.md | 101 ++++++++++++++++ .../integration-prometheus-grafana.md | 112 ++---------------- 2 files changed, 110 insertions(+), 103 deletions(-) create mode 100644 doc/integration/deploy-prometheus-grafana.md diff --git a/doc/integration/deploy-prometheus-grafana.md b/doc/integration/deploy-prometheus-grafana.md new file mode 100644 index 00000000..fb9ded0c --- /dev/null +++ b/doc/integration/deploy-prometheus-grafana.md @@ -0,0 +1,101 @@ +# Deploy Prometheus and Grafana + +There are two ways to deploy Prometheus and Grafana service in the Kubernetes environment. + +1. Deploy Prometheus and Grafana Service Directly. +2. Deploy Prometheus and Grafana Service by Operator. + +Inorder to scrape the metrics by ServiceMonitor CRD, you must install the Prometheus Operator in the Kubernetes. +That is to say, you must choose the second way to deploy Prometheus and Grafana Service. + +## 1. Deploy Prometheus and Grafana Service Directly + +### 1.1 Deploy Prometheus Service + +> SKIP this step if the Prometheus service is already available in the Kubernetes environment. + +Follow the instructions +from [Prometheus Helm Chart](https://artifacthub.io/packages/helm/prometheus-community/prometheus) to deploy the +Prometheus service into the Kubernetes environment. + +```shell +helm repo add prometheus-community https://prometheus-community.github.io/helm-charts +helm repo update prometheus-community +helm install prometheus prometheus-community/prometheus +``` + +### 1.2 Deploy Grafana Service + +> SKIP this step if the Grafana service is already available in the Kubernetes environment. + +Follow the instructions from [Grafana Helm Chart](https://artifacthub.io/packages/helm/grafana/grafana) to deploy the +Grafana service into the Kubernetes environment. + +Need override the default value of the grafana service, change the Grafana service type from default `ClusterIP` +to `LoadBalancer` in order to access the Grafana service from the outside Kubernetes network. + +An example `grafana-values.yaml` may look like as the following snippet. + +```yaml +service: + enabled: true + type: "LoadBalancer" +``` + +Install the Grafana service with the following commands. + +```shell +helm repo add grafana https://grafana.github.io/helm-charts +helm repo update grafana +helm install grafana -f grafana-values.yaml grafana/grafana +``` + +## 2. Deploy Prometheus and Grafana Service by Operator + +you can also install `kube-prometheus-stack` chart which will install Prometheus operator, Prometheus service +and Grafana service. + +```shell +helm repo add prometheus-community https://prometheus-community.github.io/helm-charts +helm repo update prometheus-community +helm install prometheus prometheus-community/kube-prometheus-stack +``` + +## 4. Login And Configure Grafana Service + +> SKIP this section if the prometheus data source is already configured in Grafana. + +### 4.1 Get Grafana Service External Address + +Run the following command to get the external ip address + +```shell +kubectl get svc grafana +``` + +A possible result may look like the follows + +```text +$ kubectl get svc grafana +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +grafana LoadBalancer 10.40.6.237 35.239.53.124 80:31362/TCP 4m25s +``` + +### 4.2 Get Grafana Admin Password + +Run the following command to get the login password for admin user. + +```shell +kubectl get secrets grafana -o yaml | grep admin-password | awk '{print $2}' | base64 -d +``` + +### 4.3 Login Grafana and Configure Prometheus Data Source + +Access Grafana web GUI with `http:///`, login with `admin:`. + +From the navigation path, `"Administration" -> "Configuration" -> "Add Data Source"`, set the HTTP.URL +to `http://prometheus-server.default`. Change `default` to the correct namespace if the prometheus service is not +deployed in the default namespace. Refer to Grafana +doc [here](https://grafana.com/docs/grafana/latest/datasources/prometheus/configure-prometheus-data-source/) for +detailed instructions. + diff --git a/doc/integration/integration-prometheus-grafana.md b/doc/integration/integration-prometheus-grafana.md index a6afeab5..ca47d89d 100644 --- a/doc/integration/integration-prometheus-grafana.md +++ b/doc/integration/integration-prometheus-grafana.md @@ -13,113 +13,16 @@ environment. From this document, you will learn, + Grafana helm chart: latest available version + StarRocks operator and helm chart: v1.7.1+ -There are two ways to deploy Prometheus and Grafana service in the Kubernetes environment. +> see [deploy-prometheus-grafana.md](./deploy-prometheus-grafana.md) for how to deploy Prometheus and Grafana. -1. Deploy Prometheus and Grafana Service Directly. -2. Deploy Prometheus and Grafana Service by Operator. - -Inorder to scrape the metrics by ServiceMonitor CRD, you must install the Prometheus Operator in the Kubernetes. That is -to say, you must choose the second way to deploy Prometheus and Grafana Service. - -## 2. Deploy Prometheus and Grafana Service Directly - -### 2.1 Deploy Prometheus Service - -> SKIP this step if the Prometheus service is already available in the Kubernetes environment. - -Follow the instructions -from [Prometheus Helm Chart](https://artifacthub.io/packages/helm/prometheus-community/prometheus) to deploy the -Prometheus service into the Kubernetes environment. - -```shell -helm repo add prometheus-community https://prometheus-community.github.io/helm-charts -helm repo update prometheus-community -helm install prometheus prometheus-community/prometheus -``` - -### 2.2 Deploy Grafana Service - -> SKIP this step if the Grafana service is already available in the Kubernetes environment. - -Follow the instructions from [Grafana Helm Chart](https://artifacthub.io/packages/helm/grafana/grafana) to deploy the -Grafana service into the Kubernetes environment. - -Need override the default value of the grafana service, change the Grafana service type from default `ClusterIP` -to `LoadBalancer` in order to access the Grafana service from the outside Kubernetes network. - -An example `grafana-values.yaml` may look like as the following snippet. - -```yaml -service: - enabled: true - type: "LoadBalancer" -``` - -Install the Grafana service with the following commands. - -```shell -helm repo add grafana https://grafana.github.io/helm-charts -helm repo update grafana -helm install grafana -f grafana-values.yaml grafana/grafana -``` - -## 3. Deploy Prometheus and Grafana Service by Operator - -you can also install `kube-prometheus-stack` chart which will install both Prometheus Operator, Prometheus service -and Grafana service. - -```shell -helm repo add prometheus-community https://prometheus-community.github.io/helm-charts -helm repo update prometheus-community -helm install prometheus prometheus-community/kube-prometheus-stack -``` - -## 4. Login And Configure Grafana Service - -> SKIP this section if the prometheus data source is already configured in Grafana. - -### 4.1 Get Grafana Service External Address - -Run the following command to get the external ip address - -```shell -kubectl get svc grafana -``` - -A possible result may look like the follows - -```text -$ kubectl get svc grafana -NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE -grafana LoadBalancer 10.40.6.237 35.239.53.124 80:31362/TCP 4m25s -``` - -### 4.2 Get Grafana Admin Password - -Run the following command to get the login password for admin user. - -```shell -kubectl get secrets grafana -o yaml | grep admin-password | awk '{print $2}' | base64 -d -``` - -### 4.3 Login Grafana and Configure Prometheus Data Source - -Access Grafana web GUI with `http:///`, login with `admin:`. - -From the navigation path, `"Administration" -> "Configuration" -> "Add Data Source"`, set the HTTP.URL -to `http://prometheus-server.default`. Change `default` to the correct namespace if the prometheus service is not -deployed in the default namespace. Refer to Grafana -doc [here](https://grafana.com/docs/grafana/latest/datasources/prometheus/configure-prometheus-data-source/) for -detailed instructions. - -## 5. Deploy StarRocks Cluster +## 2. Deploy StarRocks Cluster There are two ways to turn on the prometheus metrics scrape for the StarRocks cluster. 1. Turn on the prometheus metrics scrape by adding annotations 2. Turn on the prometheus metrics scrape by using ServiceMonitor CRD -### 5.1 Turn on the prometheus metrics scrape by adding annotations +### 2.1 Turn on the prometheus metrics scrape by adding annotations Follow the instructions from [StarRocks Helm Chart](https://artifacthub.io/packages/helm/kube-starrocks/kube-starrocks) with some customized values. @@ -129,6 +32,7 @@ Following is an example of the content of the `sr-values.yaml`. * For chart v1.7.1 and below, ```yaml +# sr-values.yaml starrocksFESpec: service: annotations: @@ -160,6 +64,7 @@ starrocksBESpec: * For chart v1.8.0 and above, ```yaml +# sr-values.yaml starrocks: starrocksFESpec: service: @@ -246,11 +151,12 @@ helm repo update starrocks-community helm install starrocks -f sr-values.yaml starrocks-community/kube-starrocks ``` -### 5.2 Turn on the prometheus metrics scrape by using ServiceMonitor CRD +### 2.2 Turn on the prometheus metrics scrape by using ServiceMonitor CRD Compared to the annotation approach, ServiceMonitor allows for more flexible definition of selector and relabeling rules in the future. -> Make sure the prometheus operator is installed in the Kubernetes environment. +> Make +> sure [Deploy Prometheus and Grafana Service by Operator](./deploy-prometheus-grafana.md#2-deploy-prometheus-and-grafana-service-by-operator) Follow the instructions from [StarRocks Helm Chart](https://artifacthub.io/packages/helm/kube-starrocks/kube-starrocks) with some customized values. @@ -264,7 +170,7 @@ starrocks: Note: This only works for chart v1.8.4 and above. -## 6. Import StarRocks Grafana Dashboard +## 3. Import StarRocks Grafana Dashboard StarRocks grafana dashboard configuration for kubernetes environment is available at https://github.com/StarRocks/starrocks/blob/main/extra/grafana/kubernetes/StarRocks-Overview-kubernetes-3.0.json