-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[YUNIKORN-2745] Log analysis adopting loki #456
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New a description of following steps. |
||
### 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mean-world
This tutorial adopts grafana helm chart instead of prometheus stack helm chart.
We should be going to adopt same grafana installation in documentations about prometheus, loki and grafana.
We can do that in YUNIKORN-2747