Creating a Managed Service for Trino cluster
The Trino cluster is created in a namespace within the project. If you already have a project and a namespace within it, you can create a cluster in that namespace.
Using the CLI
-
Make sure there is a namespace in the project. If not, create one.
-
Create the
TrinoClusterresource file, e.g., using thetouch trinocluster.yamlcommand. -
Open the file and paste the configuration below into it:
Minimum configurationConfiguration with settings and access rulesapiVersion: trino.stackland.yandex.cloud/v1alpha1 kind: TrinoCluster metadata: name: trino-min spec: version: "480" coordinator: resources: requests: cpu: 500m memory: 1Gi limits: cpu: "1" memory: 2Gi worker: replicas: 1 resources: requests: cpu: 500m memory: 1Gi limits: cpu: "1" memory: 2GiAn example with logging settings (
spec.config) and access rules for catalogs, schemas, and tables (spec.accessControl). To learn more about access rules, see Access management.apiVersion: trino.stackland.yandex.cloud/v1alpha1 kind: TrinoCluster metadata: name: trino-full spec: version: "480" deletionProtection: false coordinator: resources: requests: cpu: 500m memory: 1Gi limits: cpu: "1" memory: 2Gi worker: replicas: 3 resources: requests: cpu: 500m memory: 1Gi limits: cpu: "1" memory: 2Gi config: io.trino: INFO io.trino.plugin.iceberg: DEBUG accessControl: catalogs: - user: admin@stackland catalog: ".*" privileges: all schemas: - user: analyst@stackland catalog: ".*" schema: ".*" owner: false tables: - user: analyst@stackland catalog: ".*" schema: public table: ".*" privileges: - SELECT -
Apply the manifest:
kubectl apply -f trinocluster.yaml -n <namespace>. Optionally, you can specify the namespace in themetadata.namespaceresource property and skip it in the command.
Using the management console
-
If you have not opened a project yet, select one.
-
Select the namespace you want to create the cluster in.
-
In the left-hand menu, select Trino → Clusters.
-
Click Create cluster.
-
Fill out the fields as follows:
Basic parameters
- Name: Cluster name. Written in
metadata.name. - Trino version: Trino version. The list of values is formed from the
TrinoImageCatalogoperator. - Deletion protection: Toggle for protection against accidental cluster deletion. Disabled by default.
Coordinator configuration
- Requested CPUs: Guaranteed number of CPUs for the coordinator pod.
- Requested RAM: Guaranteed RAM for the coordinator pod.
- CPU limit: Maximum number of CPUs for the coordinator pod.
- RAM limit: Maximum RAM for the coordinator pod.
Worker configuration
- Number of workers: Number of worker pods. Minimum
1. - Requested CPUs: Guaranteed number of CPUs for the worker pod.
- Requested RAM: Guaranteed RAM for the worker pod.
- CPU limit: Maximum number of CPUs for the worker pod.
- RAM limit: Maximum RAM for the worker pod.
Additional settings (optional)
Section for adding Trino settings in the key-value format. You can add each key only once.
Access settings (optional)
Section for access rules pertaining to Trino resources. Subsections:
- Catalog rules:
user,catalog,privileges(all,read-only,none). - Schema rules:
user,catalog,schema,owner. - Table rules:
user,catalog,schema,table,privileges(SELECT,INSERT,DELETE,UPDATE,OWNERSHIP,GRANT_SELECT), plus row filter and column restrictions. - Function rules:
user,catalog,schema,function,privileges(EXECUTE,GRANT_EXECUTE,OWNERSHIP). - Procedure rules:
user,catalog,schema,procedure,privileges(EXECUTE,GRANT_EXECUTE). - Query rules:
user,queryOwner,privileges(execute,view,kill). IfqueryOwneris specified, theexecuteprivilege is not available.
In the User field, you can enter the value as a regular expression or select from Identity and Access Management. If the mapping field (e.g., Catalog, Schema, or Table) is left blank, Trino substitutes
.*. - Name: Cluster name. Written in
-
Click Create.
Done. The cluster has now appeared in the Clusters list. Once created, the cluster status is displayed in the Status column. Go to the cluster card for detailed info.
Connecting to a cluster
Once the cluster enters the Running state, you can connect to it using the coordinator's address.
Getting connection addresses
Run this command:
kubectl get trinocluster <cluster_name> -n <namespace> -o jsonpath='{.status.fqdn}'
Response structure:
external: FQDN of the coordinator for connection via Trino clients (CLI, JDBC).webUI: Trino UI FQDN.
- Open your project.
- In the left-hand menu, select Trino → Clusters.
- Select a cluster.
- On the Overview tab, find the addresses for connection. For detailed connection info, click Connect.
Trino CLI
-
Install the Trino CLI as per the official guide
. -
Connect to the cluster using the coordinator address from
status.fqdn.external:trino --server https://<coordinator_FQDN> --user <username>
JDBC
Use the Trino JDBC driver with a URL in this format:
jdbc:trino://<coordinator_FQDN>:443
Get the<coordinator_FQDN> value from status.fqdn.external.