---
title: "Deploy on Kubernetes with Tanka | Grafana Enterprise Metrics documentation"
description: "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. It is best to leverage your cloud provider’s object storage service to avoid the operational overhead of running object storage in production."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Deploy on Kubernetes with Tanka

To deploy Grafana Enterprise Metrics to Kubernetes using a Jsonnet library and [Grafana Tanka](https://tanka.dev), you can use MinIO to provide object storage. It is best to leverage your cloud provider’s object storage service to avoid the operational overhead of running object storage in production.

## Prerequisites

Before you begin, verify that you have the following:

- Kubernetes cluster
- GEM license

## Deployment instructions

1. Create a namespace:
   
   console ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```console
   $ kubectl create namespace enterprise-metrics
   ```
2. Create a Kubernetes Secret for your GEM license:
   
   console ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```console
   $ kubectl --namespace=enterprise-metrics create secret generic gem-license --from-file=license.jwt
   ```
3. Install Grafana Tanka; refer to [Installing Tanka](https://tanka.dev/install).
4. Install `jsonnet-bundler`; refer to the [`jsonnet-bundler` README](https://github.com/jsonnet-bundler/jsonnet-bundler/#install).
5. Set up Tanka environment:
   
   - a. Initialize Tanka:
     
     console ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
     
     ```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 ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
     
     ```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.
   
   console ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```console
   $ jb install github.com/grafana/jsonnet-libs/enterprise-metrics
   ```
7. Deploy MinIO object storage; refer to [Deploy Minio](../kubernetes/#deploy-minio) for the YAML manifests:
   
   console ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```console
   $ 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:
   
   console ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```console
   $ 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.
   
   console ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```console
   $ tk apply environments/enterprise-metrics/main.jsonnet
   ```
