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.yamlfile. -
Under image change value for
repositoryto:timescale/timescaledb-ha -
Change the value for
tagto:pg12.5-ts2.0.0-p0or find the current latest one at: https://hub.docker.com/r/timescale/timescaledb -
In the project root folder create a file called
.pgpass -
Open
.pgpassand 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: LoadBalancertotype: 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 (
7000in this case). The host is localhost, the user ispostgresand the password is$PGPASSWORD_POSTGRESfrom step one