Configure LDAP and SSL for Trino on Kubernetes using Helm
Prerequisites
-
An ADH cluster (4.2.0 or later) is installed.
-
Trino is deployed in Kubernetes according to the instruction.
-
SSL is enabled for the ADH cluster. This step is optional but recommended for security purposes. This guide presumes that this step was completed.
|
NOTE
The Kerberos and LDAP authentications are mutually exclusive.
|
Step 1. Update Kubernetes secrets
Your Trino installation already uses a Kubernetes secret with ADH configuration files to work with unprotected ADH services. To enable LDAP/SSL and allow Trino to work with SSL-protected ADH services, adjust the ADH configuration files within the secret.
-
Adjust the iceberg.properties file. The updated file should include the following properties:
iceberg.propertiesconnector.name=iceberg hive.metastore.uri=thrift://tsn-adh-k8s-1.ru-central1.internal:9083 hive.metastore.authentication.type=NONE hive.metastore.thrift.client.ssl.trust-certificate=/etc/ssl/truststore.jks hive.metastore.thrift.client.ssl.trust-certificate-password=<password> hive.metastore.thrift.impersonation.enabled=true fs.hadoop.enabled=True hive.hdfs.authentication.type=NONE hive.hdfs.wire-encryption.enabled=true hive.hdfs.impersonation.enabled=True hive.config.resources=/opt/trino-server/etc/catalog/core-site.xml hive.metastore.thrift.client.ssl.enabled=True -
If you use Trino with Ranger, update the Ranger configuration according to the instruction.
-
Create a file with LDAP settings:
password-authenticatorpassword-authenticator.name=ldap ldap.url=<ldap_url> ldap.user-bind-pattern=<bind_pattern> ldap.ssl.truststore.path=<truststore> ldap.ssl.turststore.password=<password> ldap.allow-insecure=falsewhere:
-
<ldap_url>is the URL for LDAP connection, e.g.ldaps://ad01.adsw.io:636. -
<bind_pattern>is the LDAP user bind pattern, e.g.CN=${USER},OU=kerberos,OU=adh,DC=ad,DC=ranger-test. -
<truststore>is a path to truststore. -
<password>is a password for truststore.
-
-
Re-create the Kubernetes secret:
$ kubectl delete secret <trino-config> -n <trino-cluster-ns> $ kubectl create secret generic <trino-config> -n <trino-cluster-ns> --from-file=core-site.xml --from-file=iceberg.properties --from-file=password-authenticatorwhere:
-
<trino-config>is the name of the secret with Hadoop/Trino configs. -
<trino-cluster-ns>is the namespace used by the Trino cluster.
-
-
Create a secret for the truststore:
$ kubectl create secret generic ca-certs -n <trino-cluster-ns> --from-file=truststore.jks=/etc/ssl/truststore.jks -
To access Trino web UI and allow JDBC connections, generate a certificate for Ingress:
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout trino-cloud.ru-central1.internal.key -out trino-cloud.ru-central1.internal.crt -subj "/CN=trino-cloud.ru-central1.internal" -
Create a secret for incoming JDBC connections:
$ kubectl create secret tls trino-tls-secret -n <trino-cluster-ns> --cert=trino-cloud.ru-central1.internal.crt --key=trino-cloud.ru-central1.internal.key -
Create a keystore for web TLS:
$ openssl pkcs12 -export -in trino-cloud.ru-central1.internal.crt -inkey trino-cloud.ru-central1.internal.key -out keystore.p12 -name trino-cloud.ru-central1.internal -
Create a secret for the keystore:
$ kubectl create secret generic trino-web-tls -n <trino-cluster-ns> --from-file=keystore.p12=./keystore.p12 -
Configure your Ingress controller or load balancer to serve HTTPS using the TLS certificate stored in Kubernetes secret. For example, if Ingress is used, append the following parameters to your Ingress configuration file:
tls: - hosts: - trino-cloud.ru-central1.internal (1) secretName: trino-tls-secret1 TLS settings for requests arriving from the given host name.
Step 2. Update the Trino cluster configuration
-
Modify the trino_cluster_values.yaml configuration file by adding the LDAP, SSL, and web TLS blocks to it. The updated file should look as follows:
trino_cluster_values.yamlimage: registry: "<registry>" repository: "<image>" tag: "<tag>" useRanger: false configsSecretName: <trino-config> worker: replicas: 2 resources: requests: cpu: 500m memory: 1Gi limits: cpu: "2" memory: 4Gi coordinator: replicas: 1 resources: requests: cpu: 500m memory: 1Gi limits: cpu: "2" memory: 4Gi ldap: enabled: true ssl: (1) secretName: ca-certs trustStoreKey: truststore.jks trustStorePassword: bigdata webTLS: (2) secretName: trino-web-tls keystoreKey: keystore.p12 keystorePassword: bigdata1 SSL settings. 2 Web TLS settings. -
Update the Trino cluster information:
$ helm upgrade --install trino-cluster oci://"$PRIVATE_REGISTRY"/adc-enterprise/charts/trino-cluster --version <version> -f trino_cluster_values.yaml --namespace <trino-cluster-ns> --create-namespace -
Delete old pods so that Trino operator creates new ones from an updated config:
$ kubectl delete pods -n <trino-cluster-ns> -l app.kubernetes.io/instance=trino-cluster -
Check that all the pods are in the
Runningstate:$ kubectl get pods -n <trino-cluster-ns>The expected output is:
NAME READY STATUS RESTARTS AGE ad-trino-cluster-coordinator-0 1/1 Running 0 4s ad-trino-cluster-worker-0 1/1 Running 0 17s ad-trino-cluster-worker-1 1/1 Running 0 4s
Step 3. Check the JDBC connection
-
Connect to the Trino cluster over JDBC, for example, using DBeaver. For this, the JDBC connection string looks as follows:
jdbc:trino://trino-cloud.ru-central1.internal:443?SSL=true&SSLTrustStorePath=<SSLTrustStorePath>&SSLTrustStorePassword=<SSLTrustStorePassword>&user=<USER>&password=<PWD>
where:
-
<USER>— username of a user in LDAP. -
<PWD>— password of a user in LDAP. -
<SSLTrustStorePath>— path to the truststore with certificates used by DBeaver. -
<SSLTrustStorePassword>— password for accessing the truststore.
-
-
Once connected, verify the Trino cluster operability:
SHOW CATALOGS;The expected output:
Catalog | ----------+ iceberg | system |