Deploy on Kubernetes with Tanka
To deploy Grafana Enterprise Logs to Kubernetes using a Jsonnet library and Grafana Tanka, you can use MinIO to provide object storage. That said, it is best to leverage your cloud provider’s object storage service to avoid the operational overhead of running object storage in production.
Prerequisites
- Kubernetes cluster
kubectl
- GEL license
Procedure
Create a Kubernetes namespace:
kubectl create namespace enterprise-logs
Create a Kubernetes Secret for your GEL license:
kubectl --namespace=enterprise-logs create secret generic gel-license --from-file=license.jwt
Install Grafana Tanka; refer to Installing Tanka.
Install
jsonnet-bundler
; refer to thejsonnet-bundler
README.Set up the Tanka environment:
Initialize Tanka
tk init --k8s=false tk env add environments/enterprise-logs tk env set environments/enterprise-logs \ --namespace=enterprise-logs \ --server-from-context=<KUBECFG CONTEXT NAME>
Install
k.libsonnet
for your version of Kubernetes:mkdir -p lib export K8S_VERSION=1.18 jb install github.com/jsonnet-libs/k8s-libsonnet/${K8S_VERSION}@main cat <<EOF > lib/k.libsonnet import 'github.com/jsonnet-libs/k8s-libsonnet/${K8S_VERSION}/main.libsonnet' EOF
Install the GEL Jsonnet library and its dependencies.
jb install github.com/grafana/loki/production/ksonnet/enterprise-logs@main
Deploy MinIO object storage; refer to Deploy Minio for the YAML manifests:
kubectl apply --namespace enterprise-logs -f minio.yaml
Deploy a GEL cluster using the MinIO object storage by replacing the contents of the
environments/enterprise-logs/main.jsonnet
file with the following configuration:export CLUSTER_NAME=<cluster-name in license.jwt> cat <<EOF > environments/enterprise-logs/main.jsonnet local gel = import 'github.com/grafana/loki/production/ksonnet/enterprise-logs/main.libsonnet'; gel { _config+:: { commonArgs+:: { 'admin.client.backend-type': 's3', 'admin.client.s3.access-key-id': 'minio', 'admin.client.s3.bucket-name': 'grafana-logs-admin', 'admin.client.s3.endpoint': 'minio:9000', 'admin.client.s3.insecure': true, 'admin.client.s3.secret-access-key': 'minio123', 'cluster-name': '$CLUSTER_NAME', }, namespace: 'enterprise-logs', boltdb_shipper_shared_store: 's3', storage_backend: 's3', s3_access_key: 'minio', s3_address: 'minio:9000', s3_bucket_name: 'grafana-logs-data', s3_secret_access_key: 'minio123', }, // Deploy tokengen Job available on a first run. tokengen_job+::: {}, } EOF
Deploy GEL:
tk apply environments/enterprise-logs/main.jsonnet