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.


  • Kubernetes cluster
  • kubectl
  • GEM license


  1. Create a Kubernetes 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:

    1. Initialize Tanka

      $ 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>
    2. Install k.libsonnet for your version of Kubernetes:

      $ mkdir -p lib
      $ export K8S_VERSION=1.18
      $ jb install${K8S_VERSION}@main
      $ cat <<EOF > lib/k.libsonnet
      import '${K8S_VERSION}/main.libsonnet'
  6. Install the Grafana Enterprise Metrics Jsonnet library.

    $ jb install
  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:

    $ export CLUSTER_NAME=<cluster-name in license.jwt>
    $ cat <<EOF > environments/enterprise-metrics/main.jsonnet
    local gem = import '';
    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',
          'cluster-name': '$CLUSTER_NAME',
      // Run without an alertmanager or ruler.
      alertmanager:: null,
      ruler:: null,
      // Make tokengen manifests available on a first run.
      tokengen+::: {}
  9. Deploy Grafana Enterprise Metrics:

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