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

yuteng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-site.git


The following commit(s) were added to refs/heads/master by this push:
     new 941f049354 [YUNIKORN-2745] Log analysis adopting loki (#456)
941f049354 is described below

commit 941f04935490357f1313b891e809e6e3ff699491
Author: mean-world <[email protected]>
AuthorDate: Mon Jul 15 20:40:49 2024 +0800

    [YUNIKORN-2745] Log analysis adopting loki (#456)
    
    * [YUNIKORN-2745] Log analysis adopting loki
    
    * [YUNIKORN-2745] Log analysis adopting loki
---
 docs/assets/grafana.png                | Bin 0 -> 147454 bytes
 docs/assets/grafana_loki_setting_1.png | Bin 0 -> 78243 bytes
 docs/assets/grafana_loki_setting_2.png | Bin 0 -> 63025 bytes
 docs/assets/loki.png                   | Bin 0 -> 135549 bytes
 docs/assets/loki_log_1.png             | Bin 0 -> 79625 bytes
 docs/assets/loki_log_2.png             | Bin 0 -> 211028 bytes
 docs/assets/loki_track_tg.png          | Bin 0 -> 75934 bytes
 docs/assets/promtail.png               | Bin 0 -> 142055 bytes
 docs/user_guide/loki.md                | 169 +++++++++++++++++++++++++++++++++
 sidebars.js                            |   1 +
 10 files changed, 170 insertions(+)

diff --git a/docs/assets/grafana.png b/docs/assets/grafana.png
new file mode 100644
index 0000000000..bb32f3c254
Binary files /dev/null and b/docs/assets/grafana.png differ
diff --git a/docs/assets/grafana_loki_setting_1.png 
b/docs/assets/grafana_loki_setting_1.png
new file mode 100644
index 0000000000..48073f6015
Binary files /dev/null and b/docs/assets/grafana_loki_setting_1.png differ
diff --git a/docs/assets/grafana_loki_setting_2.png 
b/docs/assets/grafana_loki_setting_2.png
new file mode 100644
index 0000000000..8226556474
Binary files /dev/null and b/docs/assets/grafana_loki_setting_2.png differ
diff --git a/docs/assets/loki.png b/docs/assets/loki.png
new file mode 100644
index 0000000000..dc39d0523b
Binary files /dev/null and b/docs/assets/loki.png differ
diff --git a/docs/assets/loki_log_1.png b/docs/assets/loki_log_1.png
new file mode 100644
index 0000000000..8bd1f69857
Binary files /dev/null and b/docs/assets/loki_log_1.png differ
diff --git a/docs/assets/loki_log_2.png b/docs/assets/loki_log_2.png
new file mode 100644
index 0000000000..477b80f644
Binary files /dev/null and b/docs/assets/loki_log_2.png differ
diff --git a/docs/assets/loki_track_tg.png b/docs/assets/loki_track_tg.png
new file mode 100644
index 0000000000..306cc99f56
Binary files /dev/null and b/docs/assets/loki_track_tg.png differ
diff --git a/docs/assets/promtail.png b/docs/assets/promtail.png
new file mode 100644
index 0000000000..c9155477ba
Binary files /dev/null and b/docs/assets/promtail.png differ
diff --git a/docs/user_guide/loki.md b/docs/user_guide/loki.md
new file mode 100644
index 0000000000..682cfce44d
--- /dev/null
+++ b/docs/user_guide/loki.md
@@ -0,0 +1,169 @@
+---
+id: loki
+title: Loki
+---
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+In this example, Loki, along with Promtail, is used to collect YuniKorn logs 
from the cluster. These logs are then visualized through a Grafana dashboard.
+
+## Modify YuniKorn settings
+Follow [YuniKorn install guide](https://yunikorn.apache.org/docs/) and modify 
YuniKorn configmap "yunikorn-defaults" to allow ray operator based on k8s 
service account.
+```
+kubectl patch configmap yunikorn-defaults -n yunikorn --patch 
'{"data":{"admissionController.accessControl.systemUsers": 
"^system:serviceaccount:kube-system:,^system:serviceaccount:meta:"}}' 
+```
+
+## Install Grafana 
+Install the Grafana Helm chart:
+```
+helm repo add grafana https://grafana.github.io/helm-charts
+helm repo update
+helm upgrade --install grafana grafana/grafana -n meta --create-namespace
+```
+![grafana](../assets/grafana.png)
+
+## Install Loki
+1. Create the `binary.yaml` file
+```
+#binary.yaml
+loki:
+  commonConfig:
+    replication_factor: 1
+  schemaConfig:
+    configs:
+      - from: 2024-04-01
+        store: tsdb
+        object_store: s3
+        schema: v13
+        index:
+          prefix: loki_index_
+          period: 24h
+  ingester:
+    chunk_encoding: snappy
+  tracing:
+    enabled: true
+  querier:
+    max_concurrent: 2
+
+deploymentMode: SingleBinary
+singleBinary:
+  replicas: 1
+  resources:
+    limits:
+      cpu: 1
+      memory: 2Gi
+    requests:
+      cpu: 1
+      memory: 2Gi
+  extraEnv:
+    # Keep a little bit lower than memory limits
+    - name: GOMEMLIMIT
+      value: 3750MiB
+
+chunksCache:
+  enabled: false
+  # default is 500MB, with limited memory keep this smaller
+  writebackSizeLimit: 10MB
+
+resultsCache:
+  enabled: false
+
+# Enable minio for storage
+minio:
+  enabled: true
+
+# Zero out replica counts of other deployment modes
+backend:
+  replicas: 0
+read:
+  replicas: 0
+write:
+  replicas: 0
+
+ingester:
+  replicas: 0
+querier:
+  replicas: 0
+queryFrontend:
+  replicas: 0
+queryScheduler:
+  replicas: 0
+distributor:
+  replicas: 0
+compactor:
+  replicas: 0
+indexGateway:
+  replicas: 0
+bloomCompactor:
+  replicas: 0
+bloomGateway:
+  replicas: 0
+```
+2. Install the Loki Helm chart:
+```
+helm upgrade --install loki grafana/loki -n meta -f binary.yaml
+```
+![loki](../assets/loki.png)
+
+
+:::info[Troubleshoot]
+If your Loki and Loki-minio pods remain pending, you need to delete them and 
wait for them to restart.
+:::
+
+## Install promtail
+1. Create the `promtail.yaml` file
+```
+#promtail.yaml
+config:
+  clients:
+    - url: http://loki-gateway/loki/api/v1/push
+      tenant_id: user
+      external_labels:
+        cluster: kind-cluster
+```
+2. Install the promtail Helm chart:
+```
+helm upgrade --install promtail grafana/promtail -f promtail.yaml
+```
+![promtail](../assets/promtail.png)
+
+## Grafana settings to connect to Loki
+### 1. Access the Grafana Web UI
+```
+kubectl port-forward -n meta service/grafana 3000:3000
+```
+After running port forwarding, you can access Grafana's web interface by 
[localhost:3000](http://localhost:3000) in your browser.
+
+### 2. Set URL and HTTP headers
+In grafana, adding a loki data source with url and http headers allows grafana 
to fetch logs.
+
+#### set URL field `http://loki-gateway`
+![setting_1](../assets/grafana_loki_setting_1.png)
+
+#### In order to fetch logs from promtail which tenantID is user, set HTTP 
headers field X-Scope-OrgId with user.
+![setting_2](../assets/grafana_loki_setting_2.png)
+
+## Loki log result
+1. Set tracking target
+![track_target](../assets/loki_track_tg.png)
+2. bar chart
+![bar_chart](../assets/loki_log_1.png)
+3. INFO log
+![logs trace](../assets/loki_log_2.png)
diff --git a/sidebars.js b/sidebars.js
index b21239c5c6..21b61d310a 100644
--- a/sidebars.js
+++ b/sidebars.js
@@ -35,6 +35,7 @@ module.exports = {
             'user_guide/gang_scheduling',
             'user_guide/labels_and_annotations_in_yunikorn',
             'user_guide/prometheus',
+            'user_guide/loki',
             'user_guide/use_cases',
             'user_guide/event_system',
             {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to