Skip to content

Commit 5019d56

Browse files
authored
ci: Use v2 deploy preview (#16432)
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
1 parent abf3772 commit 5019d56

File tree

2 files changed

+145
-121
lines changed

2 files changed

+145
-121
lines changed

‎.github/workflows/deploy-pr-preview.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,21 @@ on:
1111

1212
jobs:
1313
deploy-pr-preview:
14-
if: ${{ ! github.event.pull_request.head.repo.fork }}
14+
if: "!github.event.pull_request.head.repo.fork"
1515
uses: grafana/writers-toolkit/.github/workflows/deploy-preview.yml@main
1616
with:
17-
sha: ${{ github.event.pull_request.head.sha }}
1817
branch: ${{ github.head_ref }}
1918
event_number: ${{ github.event.number }}
20-
title: ${{ github.event.pull_request.title }}
2119
repo: loki
22-
website_directory: content/docs/loki/latest
23-
relative_prefix: /docs/loki/latest/
24-
index_file: true
20+
sha: ${{ github.event.pull_request.head.sha }}
21+
sources: |
22+
[
23+
{
24+
"index_file": "content/docs/loki/_index.md",
25+
"relative_prefix": "/docs/loki/latest/",
26+
"repo": "loki",
27+
"source_directory": "docs/sources",
28+
"website_directory": "content/docs/loki/latest"
29+
}
30+
]
31+
title: ${{ github.event.pull_request.title }}

‎docs/sources/get-started/_index.md

Lines changed: 132 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,34 @@ description: Provides an overview of the steps for implementing Grafana Loki to
99

1010
{{< youtube id="1uk8LtQqsZQ" >}}
1111

12-
Loki is a horizontally scalable, highly available, multi-tenant log aggregation system inspired by Prometheus. It is designed to be very cost-effective and easy to operate. It does not index the contents of the logs, but rather a set of labels for each log stream.
12+
Loki is a horizontally scalable, highly available, multi-tenant log aggregation system inspired by Prometheus.
13+
It's designed to be very cost-effective and easy to operate.
14+
It doesn't index the contents of the logs, but rather a set of labels for each log stream.
1315

14-
Because all Loki implementations are unique, the installation process is
15-
different for every customer. But there are some steps in the process that
16-
should be common to every installation.
16+
Because all Loki implementations are unique, the installation process is different for every customer.
17+
But there are some steps in the process that are common to every installation.
1718

1819
To collect logs and view your log data generally involves the following steps:
1920

2021
![Loki implementation steps](loki-install.png)
2122

22-
1. Install Loki on Kubernetes in simple scalable mode, using the recommended [Helm chart](https://grafana.com/docs/loki/<LOKI_VERSION>/setup/install/helm/install-scalable/). Supply the Helm chart with your object storage authentication details.
23+
1. Install Loki on Kubernetes in simple scalable mode, using the recommended [Helm chart](https://grafana.com/docs/loki/<LOKI_VERSION>/setup/install/helm/install-scalable/).
24+
Supply the Helm chart with your object storage authentication details.
2325
- [Storage options](https://grafana.com/docs/loki/<LOKI_VERSION>/operations/storage/)
2426
- [Configuration reference](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/)
25-
- There are [examples](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/examples/) for specific Object Storage providers that you can modify.
27+
- There are [examples](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/examples/) for specific object storage providers that you can modify.
2628
1. Deploy [Grafana Alloy](https://grafana.com/docs/alloy/latest/) to collect logs from your applications.
27-
1. On Kubernetes, deploy Grafana Alloy using the Helm chart. Configure Grafana Alloy to scrape logs from your Kubernetes cluster, and add your Loki endpoint details. See the following section for an example Grafana Alloy configuration file.
28-
1. Add [labels](https://grafana.com/docs/loki/<LOKI_VERSION>/get-started/labels/) to your logs following our [best practices](https://grafana.com/docs/loki/<LOKI_VERSION>/get-started/labels/bp-labels/). Most Loki users start by adding labels that describe where the logs are coming from (region, cluster, environment, etc.).
29+
1. On Kubernetes, deploy Grafana Alloy using the Helm chart.
30+
Configure Grafana Alloy to scrape logs from your Kubernetes cluster, and add your Loki endpoint details.
31+
Refer to the following section for an example Grafana Alloy configuration file.
32+
1. Add [labels](https://grafana.com/docs/loki/<LOKI_VERSION>/get-started/labels/) to your logs following our [best practices](https://grafana.com/docs/loki/<LOKI_VERSION>/get-started/labels/bp-labels/).
33+
Most Loki users start by adding labels that describe where the logs are coming from such as region, cluster, or environment.
2934
1. Deploy [Grafana](https://grafana.com/docs/grafana/latest/setup-grafana/) or [Grafana Cloud](https://grafana.com/docs/grafana-cloud/quickstart/) and configure a [Loki data source](https://grafana.com/docs/grafana/latest/datasources/loki/configure-loki-data-source/).
30-
1. Select the [Explore feature](https://grafana.com/docs/grafana/latest/explore/) in the Grafana main menu. To [view logs in Explore](https://grafana.com/docs/grafana/latest/explore/logs-integration/):
31-
1. Pick a time range.
32-
1. Choose the Loki data source.
33-
1. Use [LogQL](https://grafana.com/docs/loki/<LOKI_VERSION>/query/) in the [query editor](https://grafana.com/docs/grafana/latest/datasources/loki/query-editor/), use the Builder view to explore your labels, or select from sample pre-configured queries using the **Kick start your query** button.
35+
1. Select the [Explore feature](https://grafana.com/docs/grafana/latest/explore/) in the Grafana main menu.
36+
To [view logs in Explore](https://grafana.com/docs/grafana/latest/explore/logs-integration/):
37+
1. Pick a time range.
38+
1. Choose the Loki data source.
39+
1. Use [LogQL](https://grafana.com/docs/loki/<LOKI_VERSION>/query/) in the [query editor](https://grafana.com/docs/grafana/latest/datasources/loki/query-editor/), use the Builder view to explore your labels, or select from sample pre-configured queries using the **Kick start your query** button.
3440

3541
**Next steps:** Learn more about the Loki query language, [LogQL](https://grafana.com/docs/loki/<LOKI_VERSION>/query/).
3642

@@ -46,115 +52,126 @@ This sample `values.yaml` file is configured to:
4652

4753
1. Install Loki with the [Helm chart](https://grafana.com/docs/loki/<LOKI_VERSION>/setup/install/helm/install-scalable/).
4854

49-
1. Deploy either Grafana Alloy or the Grafana Agent, using the Helm chart:
50-
- [Grafana Alloy Helm chart](https://grafana.com/docs/alloy/latest/get-started/install/kubernetes/)
51-
- [Grafana Agent Helm chart](https://grafana.com/docs/agent/latest/flow/setup/install/kubernetes/)
55+
1. Deploy either Grafana Alloy or Grafana Agent, using the Helm chart:
56+
57+
- [Grafana Alloy Helm chart](https://grafana.com/docs/alloy/latest/get-started/install/kubernetes/)
58+
- [Grafana Agent Helm chart](https://grafana.com/docs/agent/latest/flow/setup/install/kubernetes/)
5259

5360
1. Create a `values.yaml` file, based on the following example, making sure to update the value for `forward_to = [loki.write.endpoint.receiver]`:
5461

55-
{{< code >}}
56-
57-
```yaml-alloy
58-
alloy:
59-
mounts:
60-
varlog: true
61-
configMap:
62-
content: |
63-
logging {
64-
level = "info"
65-
format = "logfmt"
66-
}
67-
68-
discovery.kubernetes "pods" {
69-
role = "pod"
70-
}
71-
72-
loki.source.kubernetes "pods" {
73-
targets = discovery.kubernetes.pods.targets
74-
forward_to = [loki.write.endpoint.receiver]
75-
}
76-
77-
loki.write "endpoint" {
78-
endpoint {
79-
url = "http://loki-gateway.default.svc.cluster.local:80/loki/api/v1/push"
80-
tenant_id = "local"
81-
}
82-
}
83-
84-
```
85-
86-
```yaml-static-agent
87-
agent:
88-
mounts:
89-
varlog: true
90-
configMap:
91-
content: |
92-
logging {
93-
level = "info"
94-
format = "logfmt"
95-
}
96-
97-
discovery.kubernetes "k8s" {
98-
role = "pod"
99-
}
100-
101-
discovery.relabel "k8s" {
102-
targets = discovery.kubernetes.k8s.targets
103-
104-
rule {
105-
source_labels = ["__meta_kubernetes_pod_name"]
106-
action = "replace"
107-
target_label = "pod"
108-
}
109-
rule {
110-
source_labels = ["__meta_kubernetes_pod_container_name"]
111-
action = "replace"
112-
target_label = "container"
113-
}
114-
115-
rule {
116-
source_labels = ["__meta_kubernetes_namespace", "__meta_kubernetes_pod_label_name"]
117-
target_label = "job"
118-
separator = "/"
119-
}
120-
121-
rule {
122-
source_labels = ["__meta_kubernetes_pod_uid", "__meta_kubernetes_pod_container_name"]
123-
target_label = "__path__"
124-
separator = "/"
125-
replacement = "/var/log/pods/*$1/*.log"
126-
}
127-
}
128-
129-
local.file_match "pods" {
130-
path_targets = discovery.relabel.k8s.output
131-
}
132-
133-
loki.source.file "pods" {
134-
targets = local.file_match.pods.targets
135-
forward_to = [loki.write.endpoint.receiver]
136-
}
137-
138-
loki.write "endpoint" {
139-
endpoint {
140-
url = "http://loki-gateway:80/loki/api/v1/push"
141-
tenant_id = "cloud"
142-
}
143-
}
144-
```
145-
146-
{{< /code >}}
62+
{{< tabs >}}
63+
{{< tab-content name="Grafana Alloy" >}}
64+
65+
```yaml
66+
alloy:
67+
mounts:
68+
varlog: true
69+
configMap:
70+
content: |
71+
logging {
72+
level = "info"
73+
format = "logfmt"
74+
}
75+
76+
discovery.kubernetes "pods" {
77+
role = "pod"
78+
}
79+
80+
loki.source.kubernetes "pods" {
81+
targets = discovery.kubernetes.pods.targets
82+
forward_to = [loki.write.endpoint.receiver]
83+
}
84+
85+
loki.write "endpoint" {
86+
endpoint {
87+
url = "http://loki-gateway.default.svc.cluster.local:80/loki/api/v1/push"
88+
tenant_id = "local"
89+
}
90+
}
91+
```
92+
93+
{{< /tab-content >}}
94+
{{< tab-content name="Grafana Agent" >}}
95+
96+
```yaml
97+
agent:
98+
mounts:
99+
varlog: true
100+
configMap:
101+
content: |
102+
logging {
103+
level = "info"
104+
format = "logfmt"
105+
}
106+
107+
discovery.kubernetes "k8s" {
108+
role = "pod"
109+
}
110+
111+
discovery.relabel "k8s" {
112+
targets = discovery.kubernetes.k8s.targets
113+
114+
rule {
115+
source_labels = ["__meta_kubernetes_pod_name"]
116+
action = "replace"
117+
target_label = "pod"
118+
}
119+
rule {
120+
source_labels = ["__meta_kubernetes_pod_container_name"]
121+
action = "replace"
122+
target_label = "container"
123+
}
124+
125+
rule {
126+
source_labels = ["__meta_kubernetes_namespace", "__meta_kubernetes_pod_label_name"]
127+
target_label = "job"
128+
separator = "/"
129+
}
130+
131+
rule {
132+
source_labels = ["__meta_kubernetes_pod_uid", "__meta_kubernetes_pod_container_name"]
133+
target_label = "__path__"
134+
separator = "/"
135+
replacement = "/var/log/pods/*$1/*.log"
136+
}
137+
}
138+
139+
local.file_match "pods" {
140+
path_targets = discovery.relabel.k8s.output
141+
}
142+
143+
loki.source.file "pods" {
144+
targets = local.file_match.pods.targets
145+
forward_to = [loki.write.endpoint.receiver]
146+
}
147+
148+
loki.write "endpoint" {
149+
endpoint {
150+
url = "http://loki-gateway:80/loki/api/v1/push"
151+
tenant_id = "cloud"
152+
}
153+
}
154+
```
155+
156+
{{< /tab-content >}}
157+
{{< /tabs >}}
147158
148159
1. Then install Alloy or the Agent in your Kubernetes cluster using:
149160
150-
{{< code >}}
161+
{{< tabs >}}
162+
{{< tab-content name="Grafana Alloy" >}}
163+
164+
```alloy
165+
helm install alloy grafana/alloy -f ./values.yml
166+
```
167+
168+
{{< /tab-content >}}
151169

152-
```alloy
153-
helm install alloy grafana/alloy -f ./values.yml
170+
{{< tab-content name="Grafana Agent" >}}
154171

155-
```
172+
```agent
173+
helm upgrade -f values.yaml agent grafana/grafana-agent
174+
```
156175

157-
```agent
158-
helm upgrade -f values.yaml agent grafana/grafana-agent
159-
```
160-
{{< /code >}}
176+
{{< /tab-content >}}
177+
{{< /tabs >}}

0 commit comments

Comments
 (0)