Skip to content

Commit 9639e2e

Browse files
authored
fix(helm): correct GEL provisioner tenant creation instructions (#20271)
1 parent d940433 commit 9639e2e

3 files changed

Lines changed: 54 additions & 17 deletions

File tree

‎production/helm/loki/docs/examples/enterprise/README.md‎

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ Open [overrides-enterprise-gcs.yaml](./overrides-enterprise-gcs.yaml) and replac
1818

1919
### Create Admin Token Secret (Required for Provisioner)
2020

21-
If you are using the enterprise provisioner to automatically create tenant tokens, you must first create an admin token secret:
21+
If you are using the enterprise provisioner to automatically create tenants, you must first create an admin token secret:
2222

2323
1. Generate an admin token using the Loki CLI:
2424
```bash
25-
docker run grafana/loki:latest -target=tokengen -tokengen.token-file=/tmp/token
25+
docker run grafana/enterprise-logs:latest -target=tokengen -tokengen.token-file=/tmp/token
2626
# Copy the generated token from the container
2727
docker cp <container-id>:/tmp/token ./admin-token
2828
```
29+
> Alternatively see [batchjob.yaml](batchjob.yaml) for an example that uses a configmap in k8s to retreive the bucket configuration. Note that this requires GEL to be already in place with a `helm install` command beforehand to access the data
2930
3031
2. Create the admin token secret:
3132
```bash
@@ -45,26 +46,29 @@ If you are using the enterprise provisioner to automatically create tenant token
4546
4647
`helm upgrade --install --values {PATH_TO_YOUR_OVERRIDES_YAML_FILE} {YOUR_RELEASE_NAME} grafana/loki-simple-scalable --namespace {KUBERNETES_NAMESPACE}`
4748

48-
### Get Tenant Tokens from Provisioner
49+
### Create tenants automatically via the provisioner
4950

50-
If you enabled the provisioner, retrieve the generated tenant tokens from the provisioner logs:
51+
If you enabled the provisioner, additional tenants will be automatically created based on your configuration. For example, the below will create a tenant named `loki-a`:
5152

52-
```bash
53-
# Get provisioner job logs
54-
kubectl logs -l job-name=loki-provisioner --namespace {KUBERNETES_NAMESPACE}
53+
```yaml
54+
enterprise:
55+
adminToken:
56+
secret: loki-admin-token
57+
provisioner:
58+
enabled: true
59+
additionalTenants:
60+
- name: loki-a
61+
secretNamespace: loki
5562
```
5663

57-
The provisioner outputs tokens for each configured tenant. You must manually create Kubernetes secrets for each tenant using these tokens:
64+
An additional tenant for monitoring will also be created based on the value of `.Values.monitoring.selfMonitoring.tenant`
5865

5966
```bash
60-
# Example for creating a tenant secret
61-
kubectl create secret generic <tenant-name> \
62-
--from-literal=token-write=<write-token-from-logs> \
63-
--from-literal=token-read=<read-token-from-logs> \
64-
--namespace <tenant-namespace>
67+
# Get provisioner job logs
68+
kubectl logs -l job-name=loki-provisioner --namespace {KUBERNETES_NAMESPACE}
6569
```
6670

67-
### Manual Token Generation (Without Provisioner)
71+
### Manual Token Generation
6872

6973
If you're not using the provisioner, you can manually generate tokens:
7074

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apiVersion: batch/v1
2+
kind: Job
3+
metadata:
4+
name: tokengen
5+
namespace: loki # The namespace of the GEL installation
6+
spec:
7+
backoffLimit: 0
8+
template:
9+
metadata:
10+
labels:
11+
app: tokengen
12+
spec:
13+
serviceAccountName: loki-enterprise-logs # The service account of the GEL installation which has necessary IAM permissions to the storage bucket (e.g. GCS, S3, etc.)
14+
restartPolicy: Never
15+
containers:
16+
- name: tokengen
17+
image: grafana/enterprise-logs:latest
18+
args:
19+
- -target=tokengen
20+
- -config.file=/etc/loki/config/config.yaml
21+
- -tokengen.token-file=/tmp/token
22+
volumeMounts:
23+
- name: config-volume
24+
mountPath: /etc/loki/config
25+
readOnly: true
26+
volumes:
27+
- name: config-volume
28+
configMap:
29+
name: enterprise-logs # The configmap of the GEL installation which contains the configuration of the storage bucket
30+
items:
31+
- key: config.yaml
32+
path: config.yaml

‎production/helm/loki/templates/provisioner/job-provisioner.yaml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ spec:
5353
- -exuc
5454
- |
5555
echo "================================================================================"
56-
echo "Starting provisioner. Tokens will be displayed below."
57-
echo "Copy these tokens and create secrets manually for each tenant."
56+
echo "Starting provisioner. Any configured tenants will be provisioned below."
57+
echo "If you need to manually provision a tenant, see the following documentation: "
58+
echo "https://github.com/grafana/loki/blob/main/production/helm/loki/docs/examples/enterprise/README.md"
5859
echo "================================================================================"
5960
{{- range .Values.enterprise.provisioner.additionalTenants }}
6061
echo "\nProvisioning tenant: {{ .name }}..."
@@ -78,7 +79,7 @@ spec:
7879
-token=self-monitoring
7980
{{- end }}
8081
echo "\n================================================================================"
81-
echo "Provisioning complete. Please create secrets using the tokens above."
82+
echo "Provisioning complete."
8283
echo "================================================================================"
8384
volumeMounts:
8485
{{- with .Values.enterprise.provisioner.extraVolumeMounts }}

0 commit comments

Comments
 (0)