New to KubeDB? Please start here.
Setting up Custom PgBouncerVersions
PgBouncerVersions are KubeDB crds that define the docker images KubeDB will use when deploying a pgbouncer server. For more details about PgBouncerVersion crd, please visit here.
Creating a Custom PgBouncer Image for KubeDB
If you want to create a custom image of pgbouncer with additional features, the best way is to build on top of the existing kubedb image.
FROM kubedb/pgbouncer:1.23.1
ENV SOME_VERSION_VAR 0.9.1
RUN set -ex \
&& apk add --no-cache --virtual .fetch-deps \
ca-certificates \
curl \
bash
From there, we would define a PgBouncerVersion that contains this new image. Let’s say we tagged it as myco/pgbouncer:custom-1.23.1
. You can also build exporter image yourself using pgbouncer_exporter repository.
apiVersion: catalog.kubedb.com/v1alpha1
kind: PgBouncerVersion
metadata:
name: "1.23.1"
spec:
deprecated: false
version: "1.23.1"
pgBouncer:
image: "myco/pgbouncer:custom-1.23.1"
exporter:
image: "myco/pgbouncer_exporter:v0.1.1"
Once we add this PgBouncerVersion we can use it in a new PgBouncer like:
apiVersion: kubedb.com/v1
kind: PgBouncer
metadata:
name: pgbouncer-server
namespace: demo
spec:
version: "1.23.1"
replicas: 1
connectionPool:
poolMode: session
port: 5432
reservePoolSize: 5
database:
syncUsers: true
databaseName: "postgres"
databaseRef:
name: "quick-postgres"
namespace: demo