You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by li...@apache.org on 2023/03/06 11:03:10 UTC

[dubbo-samples] branch master updated: Add helm prom demo (#772)

This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git


The following commit(s) were added to refs/heads/master by this push:
     new bc75d3b2 Add helm prom demo (#772)
bc75d3b2 is described below

commit bc75d3b28bb26853c61b5b64b4427f171085c01f
Author: ShenFeng312 <49...@users.noreply.github.com>
AuthorDate: Mon Mar 6 19:03:01 2023 +0800

    Add helm prom demo (#772)
---
 .../Deployment.yml                                 |   5 +++++
 .../dubbo-samples-metrics-spring-boot/README.md    |  21 +++++++++++++++++++--
 .../helm_result.png                                | Bin 0 -> 47942 bytes
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/4-governance/dubbo-samples-metrics-spring-boot/Deployment.yml b/4-governance/dubbo-samples-metrics-spring-boot/Deployment.yml
index d29f4db2..11894886 100644
--- a/4-governance/dubbo-samples-metrics-spring-boot/Deployment.yml
+++ b/4-governance/dubbo-samples-metrics-spring-boot/Deployment.yml
@@ -76,6 +76,11 @@ spec:
       labels:
         app: ddubbo-samples-provider
         app-type: dubbo
+      #helm-charts 配置  https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus
+      annotations:
+        prometheus.io/scrape: "true"
+        prometheus.io/path: /management/prometheus
+        prometheus.io/port: "18081"
     spec:
       containers:
         - name: ddubbo-samples-provider
diff --git a/4-governance/dubbo-samples-metrics-spring-boot/README.md b/4-governance/dubbo-samples-metrics-spring-boot/README.md
index 6fd56006..cd7def6b 100644
--- a/4-governance/dubbo-samples-metrics-spring-boot/README.md
+++ b/4-governance/dubbo-samples-metrics-spring-boot/README.md
@@ -27,11 +27,11 @@ dubbo.metrics.protocol=prometheus
 可观测性文档如下链接:
 [https://cn.dubbo.apache.org/zh/docs3-v2/java-sdk/advanced-features-and-usage/observability/](https://cn.dubbo.apache.org/zh/docs3-v2/java-sdk/advanced-features-and-usage/observability/)
 
-# 部署到K8S
+# 部署到K8S(kube-prometheus)
 本示例通过[kube-prometheus](https://github.com/prometheus-operator/kube-prometheus)
 构建k8s的prometheus环境
 
-为了方便访问验证可以将`alertmanager-service.yaml``grafana-service.yaml``prometheus-service.yaml`设置为NodePort
+为了方便访问验证可以将`alertmanager-service.yaml` `grafana-service.yaml` `prometheus-service.yaml`设置为NodePort
 
 1. 添加 `dubboPodMoitor.yaml` 到 `kube-prometheus`的`manifests` 目录。配置如下
  ```yaml
@@ -66,3 +66,20 @@ podMonitorSelector:
 4. 使用`./Deployment.yaml` 部署dubbo 应用
 5. 打开prometheus查看结果如下
    ![result.png](result.png)
+
+
+# 部署到K8S(helm-charts)
+1. 部署[prometheus](https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus)
+2. 修改Deployment.yml 并部署
+ ```yaml
+     annotations:
+        prometheus.io/scrape: "true"
+        prometheus.io/path: /management/prometheus 
+        prometheus.io/port: "18081"
+ ```
+3. 打开prometheus查看结果如下
+```shell
+ export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}")
+  kubectl --namespace default port-forward $POD_NAME 9090
+```
+![helm_result.png](helm_result.png)
\ No newline at end of file
diff --git a/4-governance/dubbo-samples-metrics-spring-boot/helm_result.png b/4-governance/dubbo-samples-metrics-spring-boot/helm_result.png
new file mode 100644
index 00000000..67872a2c
Binary files /dev/null and b/4-governance/dubbo-samples-metrics-spring-boot/helm_result.png differ


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org