Skip to content

Instantly share code, notes, and snippets.

@esomore
Last active June 6, 2019 05:37
Show Gist options
  • Save esomore/8f4f3a5cea1a14a3838568f96c7fb3f0 to your computer and use it in GitHub Desktop.
Save esomore/8f4f3a5cea1a14a3838568f96c7fb3f0 to your computer and use it in GitHub Desktop.
### deploy custom timescaledb postgres image ###
kubectl apply -f https://raw.githubusercontent.com/cosmicrocks/timescaledb/master/k8s/timescaledb/postgres-version.yaml
### deploy custom postgres user password ###
kubectl apply -f https://raw.githubusercontent.com/cosmicrocks/timescaledb/master/k8s/timescaledb/timescale-auth.yaml
### deploy timescale postgres kubedb crd ###
kubectl apply -f https://raw.githubusercontent.com/cosmicrocks/timescaledb/master/k8s/timescaledb/timescale.yaml
### deploy pg_admin ###
kubectl apply -f https://raw.githubusercontent.com/cosmicrocks/timescaledb/master/k8s/pgadmin/deployment.yaml
## port-forward to pgadmin ###
kubectl port-forward $(kubectl get pods -l app=pgadmin -o jsonpath='{.items[*].metadata.name}') 8081:80 &
and browse to https://127.0.0.1:8081
(username and password are 'admin')
### Enable timescaledb and pg_prometheus extensions ###
1) connect to the database using a temp psql pod
kubectl run \
temp-postgres-client \
--image launcher.gcr.io/google/postgresql9 \
--rm --attach --restart=Never \
-it \
-- sh -c 'exec psql --host timescaledb --dbname postgres --username postgres --password'
!!! when you are see this message: "If you don't see a command prompt, try pressing enter."
type the postgres password 'not@secret' and hit enter, this should get you into the postgres=# comand prompt
2) enable extensions
create extension timescaledb;
create extension pg_prometheus;
(hit ctrl+d to exit and delete the pod)
### deploy postgres prometheus adapter ###
kubectl apply -f https://raw.githubusercontent.com/cosmicrocks/timescaledb/master/k8s/pgadapter/deployment.yaml
kubectl apply -f https://raw.githubusercontent.com/cosmicrocks/timescaledb/master/k8s/pgadapter/svc.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment