DEV Community

Cover image for Deploy TimescaleDB 2.0 (multi node) to Kubernetes using Helm
Praveen Perera
Praveen Perera

Posted on • Edited on • Originally published at praveenperera.com

Deploy TimescaleDB 2.0 (multi node) to Kubernetes using Helm

Prerequisites

Before proceeding you will need the follow:

  1. A running kubernetes clusters.
  2. Helm CLI installed
  3. KubeCTL installed

If you don't have a kubernetes cluster, see my getting started with kubernetes with rancher and DigitalOcean managed kubernetes series

Installing Timescale DB 2.0 (Multi Node)

  1. Clone the timescale/timescaledb-kubernetes repo
git clone git@github.com:timescale/timescaledb-kubernetes.git
Enter fullscreen mode Exit fullscreen mode
  1. Delete everything except charts/timescaledb-multinode
  2. Rename this folder charts

  3. In this folder open the values.yaml file.

  4. Under image change value for repository to: timescale/timescaledb-ha

  5. Change the value for tag to: pg12.5-ts2.0.0-p0 or find the current latest one at: https://hub.docker.com/r/timescale/timescaledb

  6. In the project root folder create a file called .pgpass

  7. Open .pgpass and enter the following (use randomly generated passwords and create as many accounts as you need)

*:*:*:postgres:DATAPASS-XXXXXXXXXXXXX
*:*:*:admin:ACCESSPASS-YYYYYYYYYYYYYY
Enter fullscreen mode Exit fullscreen mode
  1. Open charts/templates/svc-timescaledb-access.yaml

  2. Change type: LoadBalancer to type: ClusterIP

  3. Go into terminal open project root folder and run

 helm install timescale-db charts --namespace=default --set credentials.accessNode.superuser="<ACCESSPASS-YYYYYYYYYYYYYY>" --set credentials.dataNode.superuser="<DATAPASS-XXXXXXXXXXXXX>"
Enter fullscreen mode Exit fullscreen mode

Accessing database locally

  1. Get the password for access node
PGPASSWORD_POSTGRES=$(kubectl get secret --namespace default timescale-db-timescaledb-access -o jsonpath="{.data.password-superuser}" | base64 --decode)
Enter fullscreen mode Exit fullscreen mode
  1. Get the name of the access node pod
ACCESS_POD=$(kubectl get pod -o name --namespace default -l release=timescale-db,timescaleNodeType=access)
Enter fullscreen mode Exit fullscreen mode
  1. Start a port forward from the access node
kubectl port-forward $ACCESS_POD 7000:5432 -n=default
Enter fullscreen mode Exit fullscreen mode
  1. Now you can access the database that's in your cluster as if it were running locally. Use whatever port you're forwarding to (7000 in this case). The host is localhost, the user is postgres and the password is $PGPASSWORD_POSTGRES from step one

Top comments (0)