Install TimescaleDB on Kubernetes
Before you begin installing TimescaleDB on a Kubernetes deployment, make sure you have installed:
If you want to, you can create your own .yaml
file to use parameters other than those specified in the default values.yaml
. You can name this file <MY_VALUES.yaml>
. For details about the parameters you can set, see the .
Install TimescaleDB on Kubernetes using a Helm chart with the default values.yaml
file. When you use the values.yaml
file, the user credentials are randomly generated during installation. Therefore, the helm upgrade
command does not rotate the credentials, because changing the database credentials would break the database. Instead, it continues to use the credentials generated during helm install
.
This section provides instructions to deploy TimescaleDB using the timescaledb-single
Helm chart.
Add the TimescaleDB Helm chart repository:
Install the TimescaleDB Helm chart, by replacing
<MY_NAME>
with a name of your choice:helm install <MY_NAME> timescale/timescaledb-single
If you created a
<MY_VALUES.yaml>
file, use this command instead:
note
If you configured the user credentials in the my_values.yaml
file, you don’t need to decode the passwords. In the following section replace MY_NAME
with the name that you provided during the installation.
Get the name of the host to connect to:
kubectl get service/<MY_NAME>
Decode the
admin
user passwordPGPASSWORD_ADMIN
that was generated during the Helm installation:<MY_NAME>-credentials -o jsonpath="{.data.PATRONI_admin_PASSWORD}" | base64 --decode)
OptionalDecode the super user password `PGPOSTGRESPASSWORD` that was generated during the Helm installation:
PGPASSWORD_POSTGRES=$(kubectl get secret --namespace default
<MY_NAME>-credentials -o jsonpath="{.data.PATRONI_SUPERUSER_PASSWORD}" | base64 --decode)
Connect to psql as
admin
user:kubectl run -i --tty --rm psql --image=postgres \
--env "PGPASSWORD=$PGPASSWORD_ADMIN" \
-h <MY_NAME>.default.svc.cluster.local postgres
Get the Pod on which TimescaleDB is installed:
Run
psql
inside the Pod containing the primary:kubectl exec -i --tty --namespace default ${MASTERPOD} -- psql -U postgres
After installing and connecting to TimescaleDB you can create a database, connect to the database, and also verify that the TimescaleDB extension is installed.
-
CREATE database tsdb;
Connect to the database you created:
\c tsdb
Verify that the TimescaleDB extension is installed by using the
\dx
command at the command prompt. The output looks like this:List of installed extensions
Name | Version | Schema | Description
You can use Helm to uninstall TimescaleDB on the Kubernetes cluster and clean up the Pods, persistent volume claim (PVC), S3 backups, and more.
To remove the spawned Pods:
Some items, such as PVCs and S3 backups, are not removed immediately. For more information about purging these items, see the Administrator Guide.
Now that you have your first TimescaleDB database up and running, see the TimescaleDB section to learn what you can do with it.
To work through some tutorials that help you get started with TimescaleDB and time-series data, check out the section.
To get help or chat with the Timescale team, get in contact.