Spin Up Your Trino Cluster Locally on Kubernetes

This guide builds a small but realistic Trino environment on your laptop: a kind Kubernetes cluster, a Trino coordinator and worker deployed with the official Helm chart, a Hive Metastore backed by PostgreSQL, and Delta Lake catalogs that read tables stored in Azure Data Lake Storage (ADLS) Gen2.

The reference files live in the trino-k8s-cluster folder of my projects repository.

1. Architecture

 Browser / Trino CLI
        |  kubectl port-forward (9090 -> 8080)
        v
 +-------------------- kind cluster "trino" --------------------+
 |  Trino coordinator  <-->  Trino worker                        |
 |        |  thrift://hive-metastore:9083                        |
 |        v                                                      |
 |  Hive Metastore  --JDBC-->  PostgreSQL (on your host)         |
 +---------------------------------------------------------------+
        |
        v  abfss:// (access key)
   ADLS Gen2 (Delta tables)
  • Trino executes queries. The coordinator plans them and workers run the tasks.
  • Hive Metastore (HMS) stores table metadata (schemas, tables, locations). It is deployed in Kubernetes and keeps its state in PostgreSQL.
  • Delta Lake connector reads Delta tables from ADLS using the metastore for discovery.

2. Repository Layout

trino-k8s-cluster/
├── trino.md
├── helm/
│   ├── install-trino.sh          # creates secrets, deploys HMS, installs Trino
│   ├── uninstall-trino.sh        # removes everything the installer created
│   └── create-oauth-secrets.sh   # optional: Microsoft Entra ID OAuth2 secrets
└── values/
    ├── values-local.yaml         # image tag, replicas, resources
    ├── catalog.yaml              # tpch, tpcds and Delta Lake catalogs
    ├── hive-metastore.yaml       # HMS Deployment and Service
    ├── oauth2-local.example.yaml # optional OAuth2 overlay
    └── trino-default-values.yaml # chart defaults, for reference only

3. Prerequisites

Tool Purpose
Docker Desktop Container runtime for kind
kind Local Kubernetes cluster
kubectl Talk to the cluster
helm Install the Trino chart
PostgreSQL Metastore database
ADLS Gen2 account Storage for Delta tables (hierarchical namespace enabled)

On macOS:

brew install kind kubectl helm

Give Docker Desktop enough resources. The coordinator requests 1 CPU / 2 GiB and the worker 1 CPU / 1 GiB, so allocate at least 4 CPUs and 8 GiB of memory.

4. Step 1: Create the Kubernetes Cluster

kind create cluster --name trino
kubectl cluster-info --context kind-trino

Confirm the node is ready:

kubectl get nodes

5. Step 2: Prepare PostgreSQL for the Metastore

The Hive Metastore connects to an existing PostgreSQL database named trinodb with the user hiveuser. Create them if needed:

CREATE DATABASE trinodb;
CREATE USER hiveuser WITH PASSWORD '<choose-a-password>';
GRANT ALL PRIVILEGES ON DATABASE trinodb TO hiveuser;

On PostgreSQL 15 or newer, where hiveuser is not the database owner, also run this inside trinodb:

GRANT USAGE, CREATE ON SCHEMA public TO hiveuser;

The kind cluster reaches your host through host.docker.internal, so PostgreSQL must accept TCP connections from the Docker network. Binding only to localhost is not enough:

  1. In postgresql.conf, set listen_addresses = '*' (or include the Docker interface).
  2. In pg_hba.conf, allow the Docker network for hiveuser, for example host trinodb hiveuser 0.0.0.0/0 scram-sha-256. Narrow the range for anything other than a throwaway laptop.
  3. Restart PostgreSQL.

6. Step 3: Provide the ADLS Access Key

Copy the example environment file at the root of the project and set the key. The .env file is git-ignored; never commit it.

cp .env.example .env
# edit .env
AZURE_ACCESS_KEY=<your-storage-account-key>

If AZURE_ACCESS_KEY is not set, the installer prompts for it without echoing it to the terminal. If a real key was ever committed to a catalog file, rotate it in Azure.

7. Step 4: Review the Configuration

Trino sizing: values-local.yaml

image:
  tag: "480"

server:
  workers: 1

additionalConfigProperties:
  - http-server.process-forwarded=true
  - catalog.management=dynamic

envFrom:
  - secretRef:
      name: trino-adls-credentials

coordinator:
  replicas: 1
  resources:
    requests: { cpu: "1", memory: "2Gi" }
    limits:   { cpu: "2", memory: "4Gi" }

worker:
  replicas: 1
  resources:
    requests: { cpu: "1", memory: "1Gi" }
    limits:   { cpu: "2", memory: "4Gi" }

envFrom injects the ADLS key as an environment variable into every Trino pod, so catalog files never contain the secret.

Catalogs: catalog.yaml

catalogs:
  tpch: |
    connector.name=tpch
  tpcds: |
    connector.name=tpcds
  trades_raw: |
    connector.name=delta_lake
    hive.metastore.uri=thrift://hive-metastore:9083
    fs.native-azure.enabled=true
    azure.auth-type=ACCESS_KEY
    azure.access-key=${ENV:AZURE_ACCESS_KEY}
    delta.register-table-procedure.enabled=true

tpch and tpcds are built-in sample data generators, useful for verifying the cluster before touching real data. trades_raw (and a second catalog, customer, with the same shape) are Delta Lake catalogs that read through the metastore. ${ENV:AZURE_ACCESS_KEY} is resolved by Trino at startup.

Hive Metastore: hive-metastore.yaml

This manifest creates a Deployment and a ClusterIP Service on port 9083. The pod uses init containers to do the setup work:

  1. download-postgres-jdbc downloads the PostgreSQL JDBC driver into a shared volume.
  2. render-hive-config generates hive-site.xml from environment variables, including the JDBC URL, credentials, and the ADLS account key.
  3. initialize-metastore-schema runs schematool -initSchema only if the schema is not already present, so re-running the installer is safe.

The main container then starts the metastore service from the apache/hive:4.0.1 image with readiness and liveness probes on the Thrift port.

8. Step 5: Run the Installer

From the project root:

bash infra/trino-k8s-cluster/helm/install-trino.sh

The script performs these actions in order:

  1. Loads .env if present and asks for any missing secret (ADLS key, PostgreSQL password) without echoing it.
  2. Creates two Kubernetes secrets using a temporary file with restricted permissions: hive-metastore-db-secret and trino-adls-credentials.
  3. Applies hive-metastore.yaml and waits for the rollout to finish.
  4. Adds the official chart repository and installs Trino:
helm repo add trino https://trinodb.github.io/charts --force-update
helm repo update
helm upgrade --install trino trino/trino \
  -f values/values-local.yaml \
  -f values/catalog.yaml \
  --wait --timeout 10m

The defaults for the database connection are host.docker.internal, port 5432, database trinodb, and user hiveuser. Override them with HMS_DB_HOST, HMS_DB_PORT, HMS_DB_NAME, and HMS_DB_USER:

HMS_DB_HOST=host.docker.internal HMS_DB_NAME=trinodb \
  bash infra/trino-k8s-cluster/helm/install-trino.sh

9. Step 6: Verify the Deployment

kubectl get pods
kubectl get svc

You should see a hive-metastore pod and the Trino coordinator and worker pods in the Running state. If a pod is stuck, inspect it:

kubectl describe pod <pod-name>
kubectl logs deployment/hive-metastore -c initialize-metastore-schema
kubectl logs deployment/trino-coordinator

10. Step 7: Reach the Trino UI

Forward the coordinator service to your machine. Port 9090 is used on the host so that it does not collide with other processes that already use 8080:

kubectl port-forward svc/trino 9090:8080

Open http://localhost:9090 for the web UI. Without authentication enabled, any username works.

11. Step 8: Run Queries

Use the Trino CLI against the forwarded port:

trino --server http://localhost:9090 --user admin

Start with the built-in sample data to confirm Trino itself works:

SHOW CATALOGS;
SELECT count(*) FROM tpch.tiny.orders;

Then check the Delta Lake catalog:

SHOW SCHEMAS FROM trades_raw;
SHOW TABLES FROM trades_raw.<schema_name>;
SELECT * FROM trades_raw.<schema_name>.<table_name> LIMIT 10;

Registering existing Delta tables

Delta tables that already exist in ADLS but are not in the metastore do not appear automatically. Because delta.register-table-procedure.enabled=true is set, register them with the connector procedure:

CALL trades_raw.system.register_table(
  schema_name => '<schema_name>',
  table_name  => '<table_name>',
  table_location => 'abfss://<container>@<account>.dfs.core.windows.net/<path>'
);

12. Optional: Microsoft Entra ID OAuth2

The repository includes oauth2-local.example.yaml and create-oauth-secrets.sh for authenticating users with Entra ID.

  1. Register an application in Entra ID and note the client ID and secret.
  2. Run bash infra/trino-k8s-cluster/helm/create-oauth-secrets.sh. It prompts for the credentials, generates a random internal shared secret with openssl, and stores them in a trino-oauth-secrets secret in the default and georestricted namespaces.
  3. Copy the example overlay, replace the issuer tenant ID with your own, and add it as an extra -f file in the Helm command.

The overlay sets authenticationType: oauth2 and allows HTTP only because clients connect through kubectl port-forward. Do not use allow-insecure-over-http outside local development. Helm replaces arrays rather than merging them, so the overlay lists both trino-adls-credentials and trino-oauth-secrets under envFrom.

13. Tear Down

Remove the Helm release, the metastore, and the secrets created by the installer:

bash infra/trino-k8s-cluster/helm/uninstall-trino.sh

To delete the whole cluster:

kind delete cluster --name trino

14. Troubleshooting

Symptom Likely cause and fix
Metastore init container fails to connect PostgreSQL only listens on localhost, or pg_hba.conf blocks the Docker network
permission denied for schema public Missing GRANT USAGE, CREATE ON SCHEMA public on PostgreSQL 15+
Port-forward fails with address in use Another process uses the port; pick a different local port such as 9091
Trino pods pending Docker Desktop has too little CPU or memory; lower the resource requests or raise the allocation
Delta table not listed The table is not registered in the metastore; use register_table
ADLS authentication errors Wrong key, or the storage account does not have hierarchical namespace enabled

15. Takeaways

  • A local kind cluster is enough to experience the full Trino and metastore deployment flow.
  • Keep secrets out of values files: the installer writes them to Kubernetes secrets and Trino reads them through ${ENV:...} substitution.
  • Layer Helm values files (values-local.yaml, then catalog.yaml, then optional overlays) so each concern stays small and replaceable.
  • Use tpch first to validate the cluster, then move on to Delta Lake data.