Provisioning, Trino / K8S

Jeonghak Choยท2025๋…„ 6์›” 1์ผ

Provisioning

๋ชฉ๋ก ๋ณด๊ธฐ
34/44

๐Ÿ“— ํ”„๋กœ๋น„์ €๋‹ - Trino / K8S

๐Ÿณ๏ธโ€๐ŸŒˆ [๊ถ๊ธˆํ•œ์ ]

  • TRINO K8S ์„ค์น˜
  • ๋ฌธ์„œ ์—ฐ๊ฒฐ

  • (์„ ํ–‰) Postgres ๊ฐ€ ์„œ๋น„์Šค๋กœ ์„ค์น˜ ๋ฐ ์‹คํ–‰๋˜์–ด์•ผ ํ•จ- Provisioning - PostgreSQL

๐Ÿ”—[๋ชฉ์ฐจ]

Trino ์„ค์น˜

1๏ธโƒฃ ์ค€๋น„

ํ—ฌ๋ฆ„ ์ฐจํŠธ ๋‹ค์šด๋กœ๋“œ

helm repo add trino https://trinodb.github.io/charts
helm pull trino/trino --untar

JDK ์„ค์น˜

sudo apt update
sudo apt install openjdk-21-jdk-headless

Trino CLI ์„ค์น˜

  • ์›ํ•˜๋Š” ๋ฒ„์ „์œผ๋กœ ๋ณ€๊ฒฝ
curl -O https://repo1.maven.org/maven2/io/trino/trino-cli/366/trino-cli-366-executable.jar
chmod +x trino-cli-366-executable.jar
sudo ln -s trino-cli-366-executable.jar /usr/local/bin/trino

2๏ธโƒฃ ์„ค์ • - ์‚ฌ์šฉ์ž Values ํŒŒ์ผ ์ƒ์„ฑ

cp values.yaml dev-values.yaml
  • dev-values.yaml ํŒŒ์ผ ํŽธ์ง‘
  • ์•„๋ž˜ ๋‚ด์šฉ ๋‚จ๊ธฐ๊ณ  ์‚ญ์ œ
service:
  type: NodePort

3๏ธโƒฃ ์„ค์น˜ - Trino ์„ค์น˜

helm install mytrino . -n trino --create-namespace -f dev-values.yaml 

NAME: mytrino
LAST DEPLOYED: Fri May 30 18:42:08 2025
NAMESPACE: trino
STATUS: deployed
REVISION: 1
NOTES:
Get the application URL by running these commands:
  export NODE_PORT=$(kubectl get --namespace trino -o jsonpath="{.spec.ports[0].nodePort}" services mytrino-trino)
  export NODE_IP=$(kubectl get nodes --namespace trino -o jsonpath="{.items[0].status.addresses[0].address}")
  echo http://$NODE_IP:$NODE_PORT
http://192.168.56.10:32501

TRINO ์„œ๋น„์Šค

kubectl get svc -n trino

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
mytrino-trino NodePort 10.111.8.162 8080:32501/TCP 53s
mytrino-trino-worker ClusterIP None 8080/TCP 53s

> ## TRINO POD
``` bash
kubectl get po -n trino

NAME                                         READY   STATUS    RESTARTS   AGE
mytrino-trino-coordinator-74f7b6955d-wqxvz   1/1     Running   0          63s
mytrino-trino-worker-54b468cb49-4xn26        1/1     Running   0          63s
mytrino-trino-worker-54b468cb49-ks77f        1/1     Running   0          63s

์›น์ฝ˜์†” ์ ‘์†

admin/ํŒจ์Šค์›Œ๋“œ๋ถˆํ•„์š”

5๏ธโƒฃ ๊ฒ€์ฆ

Postgres ๋“œ๋ผ์ด๋ฒ„ ํ™•์ธ

 k exec -it mytrino-trino-coordinator-74f7b6955d-wqxvz -n trino -- bash

[trino@mytrino-trino-coordinator-74f7b6955d-wqxvz /]$ ls /usr/lib/trino/plugin/postgresql/ | grep postgre
io.trino_trino-postgresql-475.jar
org.postgresql_postgresql-42.7.4.jar
trino-postgresql-475-services.jar

### postgreql ์นดํƒˆ๋กœ๊ทธ ์—ฐ๊ฒฐ 
``` bash
trino --server 192.168.56.10:32501 --catalog postgres --schema public

postgreql ์นดํƒˆ๋กœ๊ทธ ์—ฐ๊ฒฐ

trino:public> CREATE TABLE customers (
           ->     id INTEGER,
           ->     name VARCHAR,
           ->     email VARCHAR,
           ->     created_at TIMESTAMP
           -> );
           ->
CREATE TABLE
trino:public> SHOW TABLES;
   Table
-----------
 customers
(1 row)

Query 20250530_100845_00005_feuap, FINISHED, 3 nodes
Splits: 8 total, 8 done (100.00%)
0.44 [1 rows, 25B] [2 rows/s, 56B/s]

0๊ฐœ์˜ ๋Œ“๊ธ€