---
title: How to Deploy Metabase on Kubernetes
url: https://docs.vultr.com/how-to-deploy-metabase-on-kubernetes
description: Learn how to deploy Metabase on Kubernetes with our step-by-step guide covering installation, configuration, scaling, and troubleshooting for optimal performance.
publish_date: 2025-04-04T12:45:24.630979Z
last_updated: 2025-04-04T12:45:24.630979Z
author: Sagar Shirwalkar
header_image: https://docs.vultr.com/public/doc-assets/2141/7ea28772-c104-4a38-ae82-de1ab27fbf9b.png
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

Metabase is an open-source business intelligence tool that lets you create charts and dashboards from data. It supports databases like MySQL, PostgreSQL, MongoDB, and Redshift. By choosing to deploy Metabase on Kubernetes, you can ensure scalable real-time analytics and seamless data sharing across teams, boosting collaboration and KPI tracking.

This article explains how to deploy Metabase on a Kubernetes cluster. You will create a database and load up a sample dataset, install Metabase, and integrate the database to create a dashboard to visualize data. In addition, you will [install Nginx](https://docs.vultr.com/how-to-install-nginx-web-server-on-ubuntu-24-04) Ingress controller to expose Metabase securely using a domain name in your cluster.

## Prerequisites

Before you begin, you need to:

* Have an existing [Kubernetes cluster](https://www.vultr.com/kubernetes/).
* Have access to a [Linux-based instance, such as Ubuntu](https://www.vultr.com/servers/ubuntu/) to use as the management workstation.
* Have access to a remote [MySQL server](https://www.vultr.com/products/managed-databases/mysql/) and ensure it is accessible in your Kubernetes cluster.
* [Install and Configure Kubectl](https://docs.vultr.com/how-to-install-and-use-kubectl-to-manage-a-vke-cluster) to access your Kubernetes cluster.
* [Install Helm](https://helm.sh/docs/intro/install/) on your workstation.
* Set up a domain name to use with Metabase.

## Set Up a Sample Database

The Sakila sample database is a fictitious database designed to represent a DVD rental store featuring films, actors, film-actor relationships, and a central inventory table that connects films, stores, and rentals. Follow the steps below to set up the Sakila database to use with Metabase.

1. Install Unzip if it's not available on your workstation.

    ```console
    $ sudo apt install zip -y
    ```

1. Download the Sakila database archive from the [MySQL downloads page](https://downloads.mysql.com/).

    ```console
    $ wget https://downloads.mysql.com/docs/sakila-db.zip
    ```

1. Extract files from the `sakila-db.zip` archive.

    ```console
    $ unzip sakila-db.zip
    ```

    The Sakila archive contains three files, `sakila-schema.sql`, `sakila-data.sql`, and `sakila.mwb`.

1. Log in to your remote MySQL database server. Replace `<HOST_ENDPOINT>` with your actual MySQL hostname and `<DATABASE_PORT>` with the database server port.

    ```mysql
    $ mysql -h <HOST_ENDOINT> -P <DATABASE_PORT> -u <ADMIN_USER> -p
    ```

    Enter your password when prompted and press :key_enter: to log in.

1. Create a new `sakila` database.

    ```sql
    mysql> CREATE DATABASE sakila;
    ```

1. Execute the `sakila-schema.sql` script to create the database structure.

    ```sql
    mysql> SOURCE sakila-db/sakila-schema.sql;
    ```

1. Execute the `sakila-data.sql` script to populate the database.

    ```sql
    mysql> SOURCE sakila-db/sakila-data.sql;
    ```

## Deploy Metabase on Kubernetes

Follow the steps below to deploy Metabase by creating a deployment using the latest Metabase image and a `metabase-svc` load balancer service in your cluster.

1. Create a new `metabase.yaml` deployment YAML file.

    ```console
    $ nano metabase.yaml
    ```

1. Add the following configurations to the file to create a new deployment and service.

    ```yaml
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: metabase
    spec:
      selector:
        matchLabels:
          app: metabase
      replicas: 1
      template:
        metadata:
          labels:
            app: metabase
        spec:
          containers:
            - name: metabase
              image: metabase/metabase:latest 
              ports:
                - containerPort: 3000
                  protocol: TCP
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: metabase-svc
      annotations:
        service.beta.kubernetes.io/vultr-loadbalancer-protocol: "http"
    spec:
      type: LoadBalancer 
      selector:
        app: metabase
      ports:
        - name: http
          port: 8080
          targetPort: 3000
    ```

    Save and close the file.

1. Apply the configuration to your Kubernetes cluster to deploy Metabase.

    ```console
    $ kubectl apply -f metabase.yaml
    ```

1. View the cluster deployments and verify that the `metabase` resource is ready.

    ```console
    $ kubectl get deployments
    ```

    Output:

    ```
    NAME       READY   UP-TO-DATE   AVAILABLE   AGE
    metabase   1/1     1            1           27s
    ```

1. View all cluster services and verify the external IP of the `metabase-svc` service.

    ```console
    $ kubectl get services
    ```

    ```
    NAME          TYPE           CLUSTER-IP      EXTERNAL-IP    PORT(S)          AGE
    kubernetes    ClusterIP      10.96.0.1       <none>         443/TCP          71m
    metabase-svc  LoadBalancer   10.107.143.49   192.0.2.9      8080:30561/TCP   53s
    ```

    `192.0.2.9` is the external `metabase-svc` IP address based on the above output. The external IP address assignment may delay as the load balancer deploys to your cluster. Wait for at least `3` minutes and refresh the cluster services if the address is not available in your output.

1. Access the Metabase port `8080` using the external IP to load Metabase in your web browser.

    ```
    http://192.0.2.9:8080
    ```

    Verify that the Metabase welcome page displays in your browser.

    ![metabase_welcome](https://docs.vultr.com/public/doc-assets/2141/7fbb0eca-8cf3-48cb-857b-00853c8c724d.png)

## Configure Metabase to Access the Sample Database

Follow the steps below to configure Metabase to use the `Sakila` sample database you created earlier.

1. Click **Let's get started** on the Metabase page.
1. Select your preferred language.
1. Enter your first name, last name, email, company name, and specify a strong password in the respective fields.
1. Select your purpose for using Metabase.
1. Select MySQL as the database engine.
1. Enter a descriptive label in the `Display name` field to associate with the database.
1. Enter your MySQL host, port, database name, user name, and password information in the respective fields.
1. Click **Connect Database**.
1. Select your usage data-sharing preferences and click **Finish**.
1. Click **Take me to Metabase** to redirect to the Metabase dashboard.

    ![metabase_home](https://docs.vultr.com/public/doc-assets/2141/3b57282e-c420-4f0f-b5d3-1b02618372d2.png)

## Create a Metabase Dashboard

Follow the steps below to create a Metabase dashboard.

1. Click `+ New` in the top right corner and select `Dashboard`.
1. Enter the dashboard details in the respective fields and click **Create**.

    ![new_dashboard_details](https://docs.vultr.com/public/doc-assets/2141/79e98ec1-87be-472c-b4a4-961d737baa7d.png)

1. Click **Add a chart** within the dashboard.
1. Click the **New SQL query** and select your database.
1. Add following query to get the total revenue of all stores by date in the Sakila dataset.

    ```sql
    SELECT CAST(payment_date AS DATE) AS payment_date, SUM(amount) AS total_revenue
    FROM payment
    GROUP BY CAST(payment_date AS DATE)
    ORDER BY payment_date;
    ```

1. Click **Run Query** on the right navigation menu to view the results in a tabular format.
1. To visualize the output,
1. Click `Visualization` at the bottom left, select the `Line` option, and click **Done**.
1. Verify that a line chart displays your results.
1. Click **Save**, specify a name for your chart, and save it.
1. Verify a line chart with your results displays in the dashboard.

    ![dashboard_with_chart](https://docs.vultr.com/public/doc-assets/2141/d511c725-e866-41fc-9ab9-a5b216ded6cf.png)

## Secure Metabase with TLS Encryption

Follow the steps below to secure Metabase with TLS encryption and expose the application using the Nginx Ingress controller with trusted SSL certificates.

1. Patch the `metabase-svc` service and change the `type` from `LoadBalancer` to `ClusterIP`.

    ```console
    $ kubectl patch svc metabase-svc -p '{"spec": {"type": "ClusterIP"}}'
    ```

1. Get all cluster services and verify that the `metabase-svc` status changes to `ClusterIP`.

    ```console
    $ kubectl get services
    ```

    Output:

    ```
    NAME           TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
    kubernetes     ClusterIP   10.96.0.1      <none>        443/TCP    3h52m
    metabase-svc   ClusterIP   10.110.26.90   <none>        8080/TCP   53m
    ```

1. Use Helm to install the Nginx Ingress controller to enable TLS encryption for your Metabase deployment.

    ```console
    $ helm install my-ingress-nginx ingress-nginx \
    --repo https://kubernetes.github.io/ingress-nginx \
    --namespace ingress-nginx --create-namespace
    ```

    The above command installs the latest Nginx Ingress controller chart from the official repository in a new `ingress-nginx` namespace.

1. Get all cluster services and verify the `nginx` service's public IP address and set up a domain **A** record pointing to the address.

    ```console
    $ kubectl get services -n ingress-nginx
    ```

1. Install Cert-Manager.

    ```console
    $ kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.17.0/cert-manager.yaml
    ```

    The above command [installs cert-manager](https://docs.vultr.com/how-to-secure-a-vke-cluster-using-traefik-certmanager-and-lets-encrypt#install-cert-manager) version v1.17.0 in a new cert-manager namespace. Visit the official releases page to verify the latest version to install in your cluster.

1. Create a new `cert-issuer.yaml` manifest to set up an Issuer resource.

    ```console
    $ nano cert-issuer.yaml
    ```

1. Add the following contents to the `cert-issuer.yaml` file to specify Let's Encrypt CA and email.

    ```yaml
    apiVersion: cert-manager.io/v1
    kind: Issuer
    metadata:
      name: tls-certificate-issuer
      namespace: default 
    spec:
      acme:
        server: https://acme-v02.api.letsencrypt.org/directory
        email: abc@example.com  
        privateKeySecretRef:
          name: letsencrypt-private-key 
        solvers:
          - http01:
              ingress:
                class: nginx  
    ```

    Save and close the file.

1. Apply the Issuer resource to your cluster.

    ```console
    $ kubectl apply -f cert-issuer.yaml
    ```

1. Create a new `ingress.yaml` manifest for the Ingress resource.

    ```console
    $ nano ingress.yaml
    ```

1. Add the following contents to the `ingress.yaml` file. Replace `example.com` with your actual domain that's pointing to the Nginx Ingress Controller's external IP address.

    ```yaml
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: ingress-metabase
      annotations:
        cert-manager.io/issuer: tls-certificate-issuer
    spec:
      ingressClassName: nginx
      rules:
      - host: example.com 
        http:
          paths:
          - pathType: Prefix
            path: "/"
            backend:
              service:
                name: metabase-svc 
                port:
                  number: 8080
      tls:
      - hosts:
          - example.com  
        secretName: my-webapp-tls 
    ```

    Save and close the file.

1. Apply the Ingress resource to the cluster.

    ```console
    $ kubectl apply -f ingress.yaml
    ```

1. View all Ingress resources in your cluster.

    ```console
    $ kubectl get ingress
    ```

    ```
    NAME                        CLASS    HOSTS          ADDRESS   PORTS     AGE
    cm-acme-http-solver-l54s6   <none>   example.com              80        8s
    ingress-metabase            nginx    example.com              80, 443   11s
    ```

    The first ingress resource created by the cert-manager handles ACME challenges to verify the domain ownership. Verify that the `ingress-metabase` address changes to your controller's public IP.

    ```
    NAME                        CLASS    HOSTS          ADDRESS         PORTS     AGE
    cm-acme-http-solver-l54s6   <none>   example.com    192.0.2.11      80        5m17s
    ingress-metabase            nginx    example.com    192.0.2.11      80, 443   5m20s
    ```

1. Get all certificates and verify that the `my-webapp-tls` resource is ready.

    ```console
    $ kubectl get certificate
    ```

    Sample output:

    ```
    NAME            READY   SECRET          AGE
    my-webapp-tls   True    my-webapp-tls   20m
    ```

1. Open your Metabase dashboard using your domain name with TLS encryption.

    ```
    https://example.com
    ```

## Conclusion

You have deployed Metabase in a Kubernetes cluster and integrated a database with sample data to visualize it. You accessed Metabase with a load-balancer service, allowing you to secure connections ot the cluster. You can use Metabase to visualize data by creating charts and databases using the graphical web interface. Visit the [Metabase documentation](https://www.metabase.com/docs/latest/) for more information and configuration options.
