Integrate TimescaleDB in a Kubernetes cluster
To connect your Kubernetes cluster to your Tiger Cloud service:
Create a default namespace for your Tiger Cloud components
Create a namespace:
Set this namespace as the default for your session:
For more information, see [Kubernetes Namespaces][kubernetes-namespace].
- Create a Kubernetes secret that stores your Tiger Cloud service credentials
Update the following command with your [connection details][connection-info], then run it:
- Configure network access to Tiger Cloud
Managed Kubernetes: outbound connections to external databases like Tiger Cloud work by default. Make sure your cluster’s security group or firewall rules allow outbound traffic to Tiger Cloud IP.
Self-hosted Kubernetes: If your cluster is behind a firewall or running on-premise, you may need to allow egress traffic to Tiger Cloud. Test connectivity using your [connection details][connection-info]:
If the connection fails, check your firewall rules.
- Create a Kubernetes deployment that can access your Tiger Cloud
Run the following command to apply the deployment:
Test the connection
Create and run a pod that uses the [connection details][connection-info] you added to
timescale-secretin thetimescalenamespace:Launch a psql shell in the
test-podyou just created:
You start a psql session connected to your Tiger Cloud service.
Running TimescaleDB on Kubernetes is similar to running Postgres. This procedure outlines the steps for a non-distributed system.
To connect your Kubernetes cluster to self-hosted TimescaleDB running in the cluster:
Create a default namespace for Tiger Data components
Create the Tiger Data namespace:
Set this namespace as the default for your session:
For more information, see [Kubernetes Namespaces][kubernetes-namespace].
- Set up a persistent volume claim (PVC) storage
To manually set up a persistent volume and claim for self-hosted Kubernetes, run the following command:
- Deploy TimescaleDB as a StatefulSet
By default, the [TimescaleDB Docker image][timescale-docker-image] you are installing on Kubernetes uses the default Postgres database, user and password. To deploy TimescaleDB on Kubernetes, run the following command:
Allow applications to connect by exposing TimescaleDB within Kubernetes
Create a Kubernetes secret to store the database credentials
Deploy an application that connects to TimescaleDB
Test the database connection
Create and run a pod to verify database connectivity using your [connection details][connection-info] saved in
timescale-secret:Launch the Postgres interactive shell within the created
test-pod:
You see the Postgres interactive terminal.
You have successfully integrated Kubernetes with Tiger Cloud.
===== PAGE: https://docs.tigerdata.com/integrations/prometheus/ =====
Examples:
Example 1 (shell):
kubectl create namespace timescaleExample 2 (shell):
kubectl config set-context --current --namespace=timescaleExample 3 (shell):
kubectl create secret generic timescale-secret \
--from-literal=PGHOST=<host> \
--from-literal=PGPORT=<port> \
--from-literal=PGDATABASE=<dbname> \
--from-literal=PGUSER=<user> \
--from-literal=PGPASSWORD=<password>Example 4 (shell):
nc -zv <host> <port>