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: "483" 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: "483" 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 properties
- 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. For a service account, specify the
ServiceAccountresource name in Kubernetes, not the IAM subject ID. 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: External address of the coordinator for connection via Trino clients (CLI, JDBC). Specify a full URL inhttps://...format.webUI: Trino UI address, a full URL inhttps://...format.
- Open your project.
- In the left-hand menu, select Trino → Clusters.
- Select the cluster.
- On the Overview tab, find the addresses for connection. For detailed connection info, click Connect.
Trino CLI
To connect via an external address, use TLS and Identity and Access Management authentication via a browser. For Trino CLI, prepare a trusted certificate store, TrustStore. The commands for Linux and macOS are listed below.
Tip
You can find the ready-to-use commands for creating a TrustStore and connecting in the management console: open your cluster card and click Connect.
IAM user login
-
Install the Trino CLI as per the official guide
. To create a TrustStore, you will needkeytoolfrom JDK. -
Get the certificate authority (CA) certificate and create a TrustStore. If you already have a TrustStore configured for this cluster, use it for the connection.
Save the CA certificate from the
<cluster_name>-trino-ingress-tlssecret resource in the cluster namespace:mkdir -p ~/.trino kubectl get secret <cluster_name>-trino-ingress-tls -n <namespace> \ -o jsonpath='{.data.ca\.crt}' | base64 -d > ~/.trino/stackland-ca.crtIf you do not have access to the secret, get the CA certificate from the Stackland administrator and save it at
~/.trino/stackland-ca.crt.Import the certificate into the TrustStore.
keytool -importcert -trustcacerts -noprompt \ -alias stackland \ -file ~/.trino/stackland-ca.crt \ -keystore ~/.trino/truststore.jks \ -storetype JKS \ -storepass stacklandIn the example, the TrustStore password is
stackland; specify the same password when connecting. -
Add the CA certificate to your OS trusted certificates to sign in via a browser:
Linux (Debian, Ubuntu)Linux (RHEL, Fedora)macOSsudo cp ~/.trino/stackland-ca.crt /usr/local/share/ca-certificates/stackland.crt sudo update-ca-certificatessudo cp ~/.trino/stackland-ca.crt /etc/pki/ca-trust/source/anchors/stackland.crt sudo update-ca-trustsudo security add-trusted-cert -d -r trustRoot \ -k /Library/Keychains/System.keychain ~/.trino/stackland-ca.crtIf the browser uses its own certificate store, add the CA into it as well. Restart your browser.
-
Connect to the cluster. Under
--server, specify thestatus.fqdn.externalvalue which is the full coordinator URL inhttps://...format:trino --server https://<coordinator_FQDN> \ --external-authentication \ --truststore-path ~/.trino/truststore.jks \ --truststore-password stacklandWhen the CLI prompts you to authenticate, open the provided link in your browser and sign in to Identity and Access Management. The
current_uservalue matches the IAM login you used during the OAuth authentication. The--userparameter is optional. If required, provide--user '<IAM_login>'as a hint for the login form, or to run queries as another user if permitted byspec.accessControlrules. -
To test the connection, run a query in the Trino CLI:
SELECT current_user, version();In the
current_usercolumn, you should see the IAM login you used to sign in.
Service account login
For automation and CI, connect with a service account IAM token (t1.*) instead of browser-based OAuth authentication.
-
Create a service account in your cluster’s namespace:
kubectl create serviceaccount <service_account_name> -n <namespace>Wait until the IAM service account ID appears in the
iam.stackland.yandex.cloud/service-account-idannotation. -
Add rules to the cluster’s
spec.accessControlsection. In theuserfield, specify theServiceAccountresource name in Kubernetes, not the IAM subject ID. To learn more, see Access management. -
Get an IAM token for your service account (in
t1.*format) via the IAM API. -
Create a TrustStore by following steps 1-2 of the IAM user login section. You do not need to add the CA to your OS trusted certificates for browser logins.
-
Connect to the cluster. Under
--server, specify thestatus.fqdn.externalvalue:trino --server https://<coordinator_FQDN> \ --access-token '<IAM_token>' \ --truststore-path ~/.trino/truststore.jks \ --truststore-password stackland -
Test the connection:
SELECT current_user, version();Under
current_user, you should see the name of theServiceAccountresource fromspec.accessControl.
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 (the part of the URL without the https:// schema).