blob: 622b1a8c261609e9a9663b245ac99839f2752b28 [file] [log] [blame]
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +00001***********************************************************************
2 Welcome to Grafana Loki
3 Chart version: {{ .Chart.Version }}
Mohammed Naser7d1623e2024-06-17 09:12:39 -04004 Chart Name: {{ .Chart.Name }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +00005 Loki version: {{ .Chart.AppVersion }}
6***********************************************************************
7
Mohammed Naser7d1623e2024-06-17 09:12:39 -04008** Please be patient while the chart is being deployed **
9
10Tip:
11
12 Watch the deployment status using the command: kubectl get pods -w --namespace {{ $.Release.Namespace }}
13
14If pods are taking too long to schedule make sure pod affinity can be fulfilled in the current cluster.
15
16***********************************************************************
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +000017Installed components:
Mohammed Naser7d1623e2024-06-17 09:12:39 -040018***********************************************************************
19
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +000020{{- if .Values.monitoring.selfMonitoring.enabled }}
21* grafana-agent-operator
22{{- end }}
23{{- if eq (include "loki.deployment.isSingleBinary" .) "true" }}
Mohammed Naser7d1623e2024-06-17 09:12:39 -040024* loki
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +000025{{- else -}}
26{{- if .Values.gateway.enabled }}
27* gateway
28{{- end }}
29{{- if .Values.minio.enabled }}
Mohammed Naser7d1623e2024-06-17 09:12:39 -040030* minio
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +000031{{- end }}
Mohammed Naser65cda132024-05-02 14:34:08 -040032{{- if eq (include "loki.deployment.isScalable" .) "true" }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +000033* read
34* write
35{{- if not .Values.read.legacyReadTarget }}
36* backend
37{{- end }}
Mohammed Naser65cda132024-05-02 14:34:08 -040038{{- else }}
39* compactor
40* index gateway
41* query scheduler
42* ruler
43* distributor
44* ingester
45* querier
46* query frontend
47{{- end }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +000048{{- end }}
Mohammed Naser7d1623e2024-06-17 09:12:39 -040049
50
51{{- if eq (include "loki.deployment.isSingleBinary" .) "true" }}
52
53Loki has been deployed as a single binary.
54This means a single pod is handling reads and writes. You can scale that pod vertically by adding more CPU and memory resources.
55
56{{- end }}
57
58
59***********************************************************************
60Sending logs to Loki
61***********************************************************************
62
63{{- if .Values.gateway.enabled }}
64
65Loki has been configured with a gateway (nginx) to support reads and writes from a single component.
66
67{{- end }}
68
69You can send logs from inside the cluster using the cluster DNS:
70
71{{- if .Values.gateway.enabled }}
72
73http://{{ include "loki.gatewayFullname" . }}.{{ $.Release.Namespace }}.svc.cluster.local/loki/api/v1/push
74
75{{- else }}
76{{- if eq (include "loki.deployment.isSingleBinary" .) "true" }}
77
78http://{{ include "loki.singleBinaryFullname" . }}.{{ $.Release.Namespace }}.svc.cluster.local:{{ .Values.loki.server.http_listen_port }}/loki/api/v1/push
79
80{{- end}}
81{{- if eq (include "loki.deployment.isScalable" .) "true" }}
82
83http://{{ include "loki.writeFullname" . }}.{{ $.Release.Namespace }}.svc.cluster.local:{{ .Values.loki.server.http_listen_port }}/loki/api/v1/push
84
85{{- end }}
86{{- if eq (include "loki.deployment.isDistributed" .) "true" }}
87
88http://{{ include "loki.distributorFullname" . }}.{{ $.Release.Namespace }}.svc.cluster.local:3100/loki/api/v1/push
89
90{{- end }}
91{{- end }}
92
93You can test to send data from outside the cluster by port-forwarding the gateway to your local machine:
94{{- if .Values.gateway.enabled }}
95
96 kubectl port-forward --namespace {{ $.Release.Namespace }} svc/{{ include "loki.gatewayFullname" . }} 3100:{{ .Values.gateway.service.port }} &
97
98{{- else }}
99{{- if eq (include "loki.deployment.isSingleBinary" .) "true" }}
100
101 kubectl port-forward --namespace {{ $.Release.Namespace }} svc/{{ include "loki.singleBinaryFullname" . }} 3100:{{ .Values.loki.server.http_listen_port }} &
102
103{{- end}}
104{{- if eq (include "loki.deployment.isScalable" .) "true" }}
105
106 kubectl port-forward --namespace {{ $.Release.Namespace }} svc/{{ include "loki.writeFullname" . }} 3100:{{ .Values.loki.server.http_listen_port }} &
107
108{{- end }}
109{{- if eq (include "loki.deployment.isDistributed" .) "true" }}
110
111 kubectl port-forward --namespace {{ $.Release.Namespace }} svc/{{ include "loki.distributorFullname" . }} 3100:3100 &
112
113{{- end }}
114{{- end }}
115
116And then using http://127.0.0.1:3100/loki/api/v1/push URL as shown below:
117
118```
119curl -H "Content-Type: application/json" -XPOST -s "http://127.0.0.1:3100/loki/api/v1/push" \
120--data-raw "{\"streams\": [{\"stream\": {\"job\": \"test\"}, \"values\": [[\"$(date +%s)000000000\", \"fizzbuzz\"]]}]}"
121{{- if .Values.loki.auth_enabled }} \
122-H X-Scope-OrgId:foo
123{{- end}}
124```
125
126Then verify that Loki did received the data using the following command:
127
128```
129curl "http://127.0.0.1:3100/loki/api/v1/query_range" --data-urlencode 'query={job="test"}' {{- if .Values.loki.auth_enabled }} -H X-Scope-OrgId:foo {{- end}} | jq .data.result
130```
131
132***********************************************************************
133Connecting Grafana to Loki
134***********************************************************************
135
136If Grafana operates within the cluster, you'll set up a new Loki datasource by utilizing the following URL:
137
138{{- if .Values.gateway.enabled }}
139
140http://{{ include "loki.gatewayFullname" . }}.{{ $.Release.Namespace }}.svc.cluster.local/
141
142{{- else }}
143{{- if eq (include "loki.deployment.isSingleBinary" .) "true" }}
144
145http://{{ include "loki.singleBinaryFullname" . }}.{{ $.Release.Namespace }}.svc.cluster.local:{{ .Values.loki.server.http_listen_port }}/
146
147{{- end}}
148{{- if eq (include "loki.deployment.isScalable" .) "true" }}
149
150http://{{ include "loki.readFullname" . }}.{{ $.Release.Namespace }}.svc.cluster.local:{{ .Values.loki.server.http_listen_port }}/
151
152{{- end }}
153{{- if eq (include "loki.deployment.isDistributed" .) "true" }}
154
155http://{{ include "loki.queryFrontendFullname" . }}.{{ $.Release.Namespace }}.svc.cluster.local:3100/
156
157{{- end }}
158{{- end }}
159
160
161
162{{- if .Values.loki.auth_enabled }}
163
164***********************************************************************
165Multi-tenancy
166***********************************************************************
167
168Loki is configured with auth enabled (multi-tenancy) and expects tenant headers (`X-Scope-OrgID`) to be set for all API calls.
169
170You must configure Grafana's Loki datasource using the `HTTP Headers` section with the `X-Scope-OrgID` to target a specific tenant.
171For each tenant, you can create a different datasource.
172
173The agent of your choice must also be configured to propagate this header.
174For example, when using Promtail you can use the `tenant` stage. https://grafana.com/docs/loki/latest/send-data/promtail/stages/tenant/
175
176When not provided with the `X-Scope-OrgID` while auth is enabled, Loki will reject reads and writes with a 404 status code `no org id`.
177
178You can also use a reverse proxy, to automatically add the `X-Scope-OrgID` header as suggested by https://grafana.com/docs/loki/latest/operations/authentication/
179
180For more information, read our documentation about multi-tenancy: https://grafana.com/docs/loki/latest/operations/multi-tenancy/
181
182> When using curl you can pass `X-Scope-OrgId` header using `-H X-Scope-OrgId:foo` option, where foo can be replaced with the tenant of your choice.
183
184{{- end }}