This is documentation for the next version of Metrics enterprise. For the latest stable release, go to the latest version.

Set up GEMDeploy on Kubernetes with Tanka

Deploy on Kubernetes with Tanka

To deploy Grafana Enterprise Metrics 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
  • GEM license

1. Create a namespace:

$ kubectl create namespace enterprise-metrics

2. Create a Kubernetes Secret for your GEM license:

$ kubectl --namespace=enterprise-metrics create secret generic gem-license --from-file=license.jwt

3. Install Grafana Tanka; refer to Installing Tanka.

4. Install jsonnet-bundler; refer to the jsonnet-bundler README.

5. Set up Tanka environment:

a. Initialize Tanka

```console
$ tk init --k8s=false
$ tk env add environments/enterprise-metrics
$ tk env set environments/enterprise-metrics \
  --namespace=enterprise-metrics \
  --server-from-context=<KUBECFG CONTEXT NAME>
```

b. Install k.libsonnet for your version of Kubernetes:

```console
$ 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
```

6. Install the Grafana Enterprise Metrics Jsonnet library.

$ jb install github.com/grafana/jsonnet-libs/enterprise-metrics

7. Deploy MinIO object storage; refer to Kubernetes for the YAML manifests:

$ kubectl apply --namespace enterprise-metrics -f minio.yaml

8. Deploy a GEM cluster using the MinIO object storage by replacing the contents of the environments/enterprise-metrics/main.jsonnet file with the following configuration:

$ cat <<EOF > environments/enterprise-metrics/main.jsonnet
local gem = import 'github.com/grafana/jsonnet-libs/enterprise-metrics/main.libsonnet';

gem {
  _config+:: {
    commonArgs+:: {
      'admin.client.backend-type': 's3',
      'admin.client.s3.access-key-id': 'minio',
      'admin.client.s3.bucket-name': 'grafana-metrics-admin',
      'admin.client.s3.endpoint': 'minio:9000',
      'admin.client.s3.insecure': true,
      'admin.client.s3.secret-access-key': 'minio123',
      'blocks-storage.backend': 's3',
      'blocks-storage.s3.access-key-id': 'minio',
      'blocks-storage.s3.bucket-name': 'grafana-metrics-tsdb',
      'blocks-storage.s3.endpoint': 'minio:9000',
      'blocks-storage.s3.insecure': true,
      'blocks-storage.s3.secret-access-key': 'minio123',
    },
  },
  // Run without an alertmanager or ruler.
  alertmanager:: null,
  ruler:: null,
  // Make tokengen manifests available on a first run.
  tokengen+::: {}
}
EOF

9. Deploy Grafana Enterprise Metrics:

$ tk apply environments/enterprise-metrics/main.jsonnet