Tutorials  /  Container & Cloud

Deploy Metabase on Kubernetes – Step-by-Step Setup and TLS Security Guide

Ccentron Redaktion · November 2025 ·6 min read ·Container & Cloud, Tutorial

Metabase is an open-source business intelligence platform that allows you to create insightful dashboards and charts from your data. It supports popular databases such as MySQL, PostgreSQL, MongoDB, and Redshift. By deploying Metabase on Kubernetes, you can achieve scalable analytics in real time and facilitate data sharing across teams to improve collaboration and KPI tracking.

This guide explains how to deploy Metabase on a Kubernetes cluster. You will create a database with a sample dataset, install Metabase, connect it to your database, and visualize your data on a dashboard. Additionally, you will configure Nginx Ingress and TLS to expose Metabase securely through a domain name.

Prerequisites

Before starting, ensure the following requirements are met:

  • An existing Kubernetes cluster.
  • Access to a Linux-based workstation, such as Ubuntu.
  • Access to a remote MySQL server reachable from your cluster.
  • Kubectl configured to manage your cluster.
  • Helm installed on your workstation.
  • A registered domain name to use with Metabase.
K8

Matching infrastructure at centron

From container to cluster: managed Kubernetes with cStack starts at €29.99 per month – control plane, autoscaler and traffic included. Explore managed Kubernetes →

Set Up a Sample Database

The Sakila sample database simulates a DVD rental store with data on films, actors, stores, and rentals. Follow these steps to configure Sakila for use with Metabase.

Install Unzip if not already available:

Console
$ sudo apt install zip -y

Download the Sakila database archive:

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

Extract the Sakila archive:

Console
$ unzip sakila-db.zip

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

Log in to your MySQL server (replace placeholders with actual values):

Console
$ mysql -h  -P  -u  -p

Create the Sakila database:

Code
mysql> CREATE DATABASE sakila;

Load the database structure:

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

Import the data into the database:

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

Deploy Metabase on Kubernetes

Next, deploy Metabase on your Kubernetes cluster using a deployment file and load balancer service.

Create the deployment manifest:

Console
$ nano metabase.yaml

Add the following configuration:

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
spec:
  type: LoadBalancer
  selector:
    app: metabase
  ports:
    - name: http
      port: 8080
      targetPort: 3000

Apply the deployment:

Console
$ kubectl apply -f metabase.yaml

Verify deployments and services:

Console
$ kubectl get deployments

Check services for the external IP address:

Console
$ kubectl get services

Access Metabase in your browser using the external IP:

http://192.0.2.9:8080

Configure Metabase with the Sample Database

Follow these steps to connect Metabase with the Sakila database and create a dashboard:

  1. Click Let's get started.
  2. Select your preferred language.
  3. Enter your details (name, email, company, and password).
  4. Select MySQL as your database engine.
  5. Provide database credentials and click Connect Database.
  6. Set your data-sharing preferences and click Finish.
  7. Click Take me to Metabase to open the dashboard.

Create a Metabase Dashboard

To create a new dashboard:

  1. Click + NewDashboard.
  2. Fill in dashboard details and click Create.
  3. Add a chart → New SQL query → select your database.

Run the following SQL query to calculate total revenue per day:

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;

Click Run Query to view results, choose Visualization → Line, then Save your chart. Your dashboard will now show a line chart displaying daily revenue.

Secure Metabase with TLS Encryption

Secure the Metabase deployment by enabling TLS encryption using Nginx Ingress and Cert-Manager.

Change the service type to ClusterIP:

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

Install Nginx Ingress controller with Helm:

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

Install Cert-Manager:

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

Create an Issuer manifest:

Console
$ nano cert-issuer.yaml

Add the following content:

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

Apply the Issuer configuration:

Console
$ kubectl apply -f cert-issuer.yaml

Create and apply an Ingress manifest:

Console
$ nano ingress.yaml

Add the following content (replace example.com with your domain):

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

Apply the Ingress file:

Console
$ kubectl apply -f ingress.yaml

Once issued, access Metabase securely via HTTPS:

https://example.com

Conclusion

You have successfully deployed Metabase in a Kubernetes cluster, integrated it with a sample database, and visualized data in dashboards. You also secured Metabase with TLS encryption through Nginx Ingress. Explore the official Metabase documentation for more advanced configuration and usage options.

Jetzt 200 € Guthaben sichern

Testen Sie Ihr Setup auf ccloud³

Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.

centron Redaktion Technische Redaktion

Das Redaktionsteam von centron schreibt Anleitungen aus dem Betriebsalltag: getestet auf unserer eigenen Plattform, betrieben im Rechenzentrum in Hallstadt bei Bamberg.

Kategorie Container & Cloud
Teilen
Noch offene Fragen?

Our team will help you with your specific setup - in German or English, by people who run the platform themselves.

War dieses Tutorial hilfreich?

Your answer is stored anonymously and helps us improve our tutorials.

Kommentare

No comments yet - be the first to ask a question about this tutorial.

Sign in to comment

Comments are open to centron customers. Sign in to your account to ask a question about this tutorial.

Weiterlesen

Das könnte Sie auch interessieren

Jetzt kostenlos anfangen

Melden Sie sich an und erhalten Sie in den ersten 60 Tagen ein Guthaben von 200 € bei centron.

Dieses Werbeangebot gilt nur für neue Konten. Angebot ausschließlich für Gewerbetreibende.

Jetzt loslegen Sales kontaktieren