Configure web TLS for Trino on Kubernetes via Helm
Overview
You can enable HTTPS for the Trino coordinator web endpoint (port 8443), while communication with Trino workers continues to use HTTP (port 8080).
For this, use the webTLS parameter group as shown in the example.
Unlike ssl settings that use a keystore and truststore mounted both on the coordinator and worker pods, webTLS makes the Trino coordinator act as a TLS server with a keystore, so worker pods never get the private key.
Trino in Kubernetes supports the following modes of TLS termination (the point where HTTPS gets decrypted):
-
Ingress TLS termination (default). An Ingress controller terminates TLS traffic and forwards requests to the coordinator over HTTP. The
trino-clusterIngress always targets the coordinator’s HTTP port, so this path is unaffected bywebTLS. -
Coordinator HTTPS (
webTLS). Exposes the8443port directly (load balancer or Ingress SSL-passthrough) and does not terminate TLS at the Ingress level.webTLSis an alternative to Ingress TLS termination, not an addition to it.
Enabling both approaches may result in terminating every request twice.
Double TLS termination occurs if you enable re-encryption (for example, Ingress terminates the client TLS, then re-encrypts requests to the coordinator on 8443).
This requires pointing the Ingress backend at the HTTPS port with the appropriate backend-protocol annotation.
Prerequisites
-
Trino is deployed in Kubernetes according to the instruction.
-
A PKCS12 keystore is created:
$ openssl pkcs12 -export \ -in <tls.crt> \ -inkey <tls.key> \ -out <keystore.p12> \ -passout pass:<password>
Deployment steps
Step 1. Create a secret with a keystore
Create a Kubernetes secret with a PKCS12 keystore. For example:
$ kubectl -n trino create secret generic trino-web-tls --from-file=keystore.p12
Step 2. Update Trino cluster configuration
-
Add the
webTLSconfiguration block to the trino-cluster.yaml Helm values file:trino-cluster.yamlimage: registry: "hub.adsw.io" repository: "adc-develop-enterprise/trino" tag: "481.2-adc-develop-1.5.0" ## Specify a pullPolicy ## ref: https://kubernetes.io/docs/concepts/containers/images/#pre-pulled-images ## pullPolicy: "Always" ## Existing secret or secret to create to use for image pulling, they must exist in all product namespaces ## pullSecret: name: "" credentials: {} # registry: private-docker-registry # username: user # password: pass ## @param useRanger enabled and disabled ranger. ## #useRanger: false ## Uncomment to enable LDAP authentication. ## #ldap: # enabled: false ## Uncomment to enable Kerberos authentication. ## ## `service` defaults to `trino`; override only if clients expect a different service name. ## ## Keytab settings live under `kerberos.keytab`: ## - Set `keytab.create: true` to let the chart render a Keytab CR; kerberos-operator ## will then create the Secret with the keytab and krb5.conf. In that case you also ## need `keytab.labelSelector` so the KDC host is picked up. ## - If you already have a Secret with the keytab, leave `keytab.create` off and point ## the chart at it with `keytab.secretName`. ## - Use `keytab.additionalPrincipals` to add extra entries to the Keytab CR, for example ## the ingress hostname (`HTTP/<ingress-dns>`) so SPNEGO works. ## #kerberos: # realm: EXAMPLE.COM # hostname: trino.example.com # service: trino # keytab: # create: true # secretName: "" # labelSelector: {} # rotation: # interval: 720h # checkInterval: 1h # additionalPrincipals: [] # # - HTTP/trino.example.com ## SSL / truststore and keystore settings. ## These are the truststore and keystore files that Trino uses as a client ## (for example to reach a TLS-enabled metastore). They are mounted into both ## coordinator and worker pods. ## #ssl: # secretName: "ca-store" # trustStoreKey: "truststore.jks" # keyStoreKey: "keystore.jks" ## webTLS - HTTPS on the coordinator web endpoint. Rendered on the Cluster CR ## when `webTLS.secretName` is set (same as `ssl` above). ## Unlike `ssl` above (client truststore/keystore), webTLS terminates TLS on the ## coordinator itself: the coordinator serves its web/API endpoint over HTTPS on ## port 8443, while workers and internal discovery keep using HTTP 8080. ## Use it instead of terminating TLS at the ingress, not in addition to it. ## webTLS: secretName: trino-web-tls (1) keystoreKey: keystore.p12 (2) keystorePassword: "<password>" (3) ## Specify the name of configSecret where hadoop/ranger/connector config were stored ## configsSecretName: "" catalogs: (4) iceberg.properties: connector.name: iceberg fs.hadoop.enabled: "true" hive.config.resources: /opt/trino-server/etc/catalog/core-site.xml hive.hdfs.impersonation.enabled: "true" hive.metastore.thrift.impersonation.enabled: "true" hive.metastore.uri: thrift://ka-adh-k8s-1.ru-central1.internal:9083 ## Controls whether changes to referenced Secrets trigger an automatic pod rollout. ## Set enabled: false to update referenced Secrets without restarting the workload; ## pods keep running the previous configuration until the policy is re-enabled. ## Defaults to enabled. ## #configurationRollout: # enabled: true ## Uncomment to enable Trino History Server. ## `database` is required. The operator reads the credentials Secret but never ## creates it, so create it beforehand in the same namespace. It must contain ## the keys `username` and `password`; the JDBC URL is given separately as ## `database.url`. `coordinatorUrl` overrides the coordinator address used by ## the History Server; `url` overrides the History Server address used by the ## coordinator. `tls` turns on mutual TLS between the coordinator and the ## History Server; the Secret holds `keystore.p12` and `truststore.p12`, as a ## cert-manager Certificate with PKCS12 output writes it. ## #historyServer: # database: # url: jdbc:postgresql://pg.db:5432/trino_history # credentials: # secretName: trino-history-db # coordinatorUrl: http://trino-coordinator.adh:8080 # url: http://trino-history-server.adh:8088 # tls: # secretName: trino-history-tls # keyStorePassword: changeit # trustStorePassword: changeit # replicas: 1 # args: # ttl.duration: 30d worker: ## @param replicas set number of executor replicas ## replicas: 1 annotations: {} ## Additional environment variables for the worker container ## envs: [] # - name: JAVA_TOOL_OPTIONS # value: "-Djavax.net.ssl.trustStore=/etc/ssl/truststore.jks" ## Additional configuration that you want to be added to worker-config args: {} # task.max-worker-threads: 8 ## Set container requests and limits for resource like CPU or memory (essential for production workloads) ## resources: {} #limits: # cpu: "2" # memory: "8Gi" #requests: # cpu: "2" # memory: "8Gi" ## Pod-level security context applied to the pod (rendered as spec.<component>.spec.podSecurityContext) ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ ## podSecurityContext: {} # runAsUser: 1001 # runAsGroup: 1001 # fsGroup: 1001 ## Container-level security context applied to the container (rendered as spec.<component>.spec.securityContext) ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ ## securityContext: {} # runAsNonRoot: true # readOnlyRootFilesystem: true # allowPrivilegeEscalation: false # capabilities: # drop: # - ALL ## Request additional PVC for pod ## persistentVolume: {} # mountPath: "/data/trino" # volumeClaimTemplates: # - metadata: # name: data # spec: # accessModes: ["ReadWriteOnce"] # resources: # requests: # storage: 10Gi # storageClassName: default ## nodeAffinity: Object defining constraints to place pods on a specific set of Nodes ## nodeSelector: {} topologySpreadConstraints: [] ## Allow a Pod to be scheduled onto nodes that have taints. ## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ ## tolerations: [] # - key: "example-key" # operator: "Exists" # effect: "NoSchedule" ## affinity: Object defining soft rules to place pods on a specific set of Nodes or didn't place pod to nodes due to some conditions ## affinity: {} # nodeAffinity: # requiredDuringSchedulingIgnoredDuringExecution: # nodeSelectorTerms: # - matchExpressions: # - key: topology.kubernetes.io/zone # operator: In # values: # - antarctica-east1 # - antarctica-west1 # preferredDuringSchedulingIgnoredDuringExecution: # - weight: 1 # preference: # matchExpressions: # - key: another-node-label-key # operator: In # values: # - another-node-label-value startupProbe: {} # httpGet: # path: /v1/info # port: 8080 # scheme: HTTP # initialDelaySeconds: 20 # periodSeconds: 5 # timeoutSeconds: 3 # successThreshold: 1 # failureThreshold: 2 livenessProbe: {} # httpGet: # path: /v1/info # port: 8080 # scheme: HTTP # initialDelaySeconds: 20 # periodSeconds: 5 # timeoutSeconds: 3 # successThreshold: 1 # failureThreshold: 2 readinessProbe: {} # exec: # command: # - sh # - -c # - test -f /opt/trino-server/etc/truststore/custom-truststore.jks # initialDelaySeconds: 20 # periodSeconds: 5 # timeoutSeconds: 3 # successThreshold: 1 # failureThreshold: 2 ## Mount additional secrets into the pod ## mountSecrets: [] # - secretName: my-secret # mountPath: /etc/trino/my-secret ## Additional container/Service ports. ## ports: [] # - name: http-metrics # containerPort: 9209 # servicePort: 9209 # protocol: TCP coordinator: ## @param replicas set number of executor replicas ## replicas: 1 annotations: {} ## Additional environment variables for the coordinator container ## envs: [] # - name: JAVA_TOOL_OPTIONS # value: "-Djavax.net.ssl.trustStore=/etc/ssl/truststore.jks" ## Additional configuration that you want to be added to coordinator-config args: {} # query.max-memory-per-node: 2GB ## Set container requests and limits for resource like CPU or memory (essential for production workloads) ## resources: {} #limits: # cpu: "2" # memory: "8Gi" #requests: # cpu: "2" # memory: "8Gi" ## Pod-level security context applied to the pod (rendered as spec.<component>.spec.podSecurityContext) ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ ## podSecurityContext: {} # runAsUser: 1001 # runAsGroup: 1001 # fsGroup: 1001 ## Container-level security context applied to the container (rendered as spec.<component>.spec.securityContext) ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ ## securityContext: {} # runAsNonRoot: true # readOnlyRootFilesystem: true # allowPrivilegeEscalation: false # capabilities: # drop: # - ALL ## Request additional PVC for pod ## persistentVolume: {} # mountPath: "/data/trino" # volumeClaimTemplates: # - metadata: # name: data # spec: # accessModes: ["ReadWriteOnce"] # resources: # requests: # storage: 10Gi # storageClassName: default ## nodeAffinity: Object defining constraints to place pods on a specific set of Nodes ## nodeSelector: {} # node.kubernetes.io/worker: "true" topologySpreadConstraints: [] ## Allow a Pod to be scheduled onto nodes that have taints. ## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ ## tolerations: [] # - key: "example-key" # operator: "Exists" # effect: "NoSchedule" ## affinity: Object defining soft rules to place pods on a specific set of Nodes or didn't place pod to nodes due to some conditions ## affinity: {} # nodeAffinity: # requiredDuringSchedulingIgnoredDuringExecution: # nodeSelectorTerms: # - matchExpressions: # - key: topology.kubernetes.io/zone # operator: In # values: # - antarctica-east1 # - antarctica-west1 # preferredDuringSchedulingIgnoredDuringExecution: # - weight: 1 # preference: # matchExpressions: # - key: another-node-label-key # operator: In # values: # - another-node-label-value startupProbe: {} # httpGet: # path: /v1/info # port: 8080 # scheme: HTTP # initialDelaySeconds: 20 # periodSeconds: 5 # timeoutSeconds: 3 # successThreshold: 1 # failureThreshold: 2 livenessProbe: {} # httpGet: # path: /v1/info # port: 8080 # scheme: HTTP # initialDelaySeconds: 20 # periodSeconds: 5 # timeoutSeconds: 3 # successThreshold: 1 # failureThreshold: 2 readinessProbe: {} # exec: # command: # - sh # - -c # - test -f /opt/trino-server/etc/truststore/custom-truststore.jks # initialDelaySeconds: 20 # periodSeconds: 5 # timeoutSeconds: 3 # successThreshold: 1 # failureThreshold: 2 ## Mount additional secrets into the pod ## mountSecrets: [] # - secretName: my-secret # mountPath: /etc/trino/my-secret ## Additional container/Service ports. ## ports: [] # - name: http-metrics # containerPort: 9209 # servicePort: 9209 # protocol: TCP ## Specify an ingress settings ## ref: https://kubernetes.io/docs/concepts/services-networking/ingress ## ingress: ## You can choose whether to use ingress or not. If "not" you can create internal loadBalancer with coordinator.serviceAnnotations parameter. enabled: false ## Specify ingress rule settings host: path: "" pathType: ImplementationSpecific ingressClassName: "" annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" ## Specify tls settings tls: ## Whether to use tls for ingress or not enabled: false ## specify secret with tls certificate secretName: ""1 Kubernetes secret name. 2 PKCS12 key to use for TLS. 3 Keystore password. 4 Iceberg catalog parameters. -
Upgrade the Trino cluster configuration:
$ helm upgrade --install trino-cluster oci://<registry-address>/adc-enterprise/charts/trino-cluster:<version> -f trino-cluster.yaml --namespace trino --create-namespace -
Verify the Trino cluster pods:
$ kubectl get pods -n trinoThe expected output is:
NAME READY STATUS RESTARTS AGE trino-coordinator-0 1/1 Running 0 52s trino-worker-0 1/1 Running 0 52s
Step 3. Check the JDBC connection
-
Connect to the Trino cluster over JDBC, for example, using DBeaver. After enabling web TLS, the JDBC connection string looks as follows:
jdbc:trino://trino-cloud.ru-central1.internal:8443?SSL=true&SSLTrustStorePath=<truststore_path>&SSLTrustStorePassword=<password>
-
Once connected, verify the Trino cluster operability:
SHOW CATALOGS;The expected output:
Catalog | ----------+ iceberg | system |