Prerequisites
Before proceeding you will need the follow:
If you don’t have a kubernetes cluster, see my getting started with kubernetes with rancher and DigitalOcean managed kubernetes series
Deploying TimescaleDB 2.0 (Multi Node)
- Clone the timescale/timescaledb-kubernetes repo
git clone [email protected]:timescale/timescaledb-kubernetes.git
-
Delete everything except
charts/timescaledb-multinode
-
Rename this folder
charts
-
In this folder open the
values.yaml
file. -
Under image change value for
repository
to:timescale/timescaledb-ha
-
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 -
In the project root folder create a file called
.pgpass
-
Open
.pgpass
and enter the following (use randomly generated passwords and create as many accounts as you need)
*:*:*:postgres:DATAPASS-XXXXXXXXXXXXX
*:*:*:admin:ACCESSPASS-YYYYYYYYYYYYYY
-
Open
charts/templates/svc-timescaledb-access.yaml
-
Change
type: LoadBalancer
totype: ClusterIP
-
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>"
Accessing database locally
- Get the password for access node
PGPASSWORD_POSTGRES=$(kubectl get secret --namespace default timescale-db-timescaledb-access -o jsonpath="{.data.password-superuser}" | base64 --decode)
- Get the name of the access node pod
ACCESS_POD=$(kubectl get pod -o name --namespace default -l release=timescale-db,timescaleNodeType=access)
- Start a port forward from the access node
kubectl port-forward $ACCESS_POD 7000:5432 -n=default
-
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 ispostgres
and the password is$PGPASSWORD_POSTGRES
from step one