pgbouncer

by serge.logvinov

Helm chartv0.20.0App 16.16Verified publisher

Postgres connection poller

About this chart

pgbouncer

Postgres connection poller

PgBouncer is a lightweight connection pooler for PostgreSQL. It is designed to manage and optimize database connections by limiting the number of active connections to a PostgreSQL database, which helps improve performance and resource usage, especially in high-traffic environments.

Homepage: https://github.com/sergelogvinov/helm-charts

Maintainers

NameEmailUrl
sergelogvinovhttps://github.com/sergelogvinov

Source Code

# helm values

userlist:
  # "username" "password"
  # "md5" + "md5(password + username)" // echo -n '1234admin' | md5 -> md545f2603610af569b6155c45067268c6b
  pgbouncer: password
  betmaster: md5$HASH

databases:
  betmaster:
    host: pg-0.pg-headless
    port: 5432
    user: username
    dbname: database
    poolmode: session

users:
  username2:
    poolmode: transaction

pgHbaConfiguration: |-
  hostssl all         all                   0.0.0.0/0       md5

serverSslMode: require
clientSslMode: require

updateStrategy:
  type: OnDelete

metrics:
  enabled: true

Values

KeyTypeDefaultDescription
replicaCountint1
image.repositorystring"ghcr.io/sergelogvinov/pgbouncer"
image.pullPolicystring"IfNotPresent"
image.tagstring""
kubeVersionstring""
imagePullSecretslist[]
nameOverridestring""
fullnameOverridestring""
databasesobject{}
usersobject{}
userlist.pgbouncerstring"pgbouncer"
pgHbaConfigurationstring"# host database user address auth-method\nhost all all 10.0.0.0/8 md5\nhostssl all all 0.0.0.0/0 md5"
customSettingsobject{}
serverSslModestring"allow"Server TLS configuration. ref: https://www.pgbouncer.org/config.html#server_tls_sslmode
serverSslSecretstring""Server TLS secret name (cert-manager).
serverSslobject{}Server TLS secrets. ref: https://www.pgbouncer.org/config.html#server_tls_ca_file ca, cert, key: If you want to use your own certificates, you can provide them here.
clientSslModestring"allow"Client TLS configuration. ref: https://www.pgbouncer.org/config.html#client_tls_sslmode
clientSslSecretstring""
podLabelsobject{}Extra labels for pod. ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
podAnnotationsobject{}Annotations for pod. ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
podSecurityContextobject{"fsGroup":999,"fsGroupChangePolicy":"OnRootMismatch","runAsGroup":999,"runAsNonRoot":true,"runAsUser":999}Pod Security Context. ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod
securityContextobject{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"seccompProfile":{"type":"RuntimeDefault"}}Container Security Context. ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod
serviceobject{"annotations":{},"ipFamilies":["IPv4"],"port":5432,"trafficDistribution":"","type":"ClusterIP"}Service parameters ref: https://kubernetes.io/docs/user-guide/services/
service.typestring"ClusterIP"Service type ref: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
service.portint5432Service port
service.annotationsobject{}Annotations for service
service.ipFamilieslist["IPv4"]IP families for service possible values: IPv4, IPv6 ref: https://kubernetes.io/docs/concepts/services-networking/dual-stack/
service.trafficDistributionstring""The traffic distribution for the service. possible values: PreferClose ref: https://kubernetes.io/docs/concepts/services-networking/service/#traffic-distribution
resourcesobject{"limits":{"memory":"128Mi"},"requests":{"cpu":"100m","memory":"64Mi"}}Resource requests and limits ref: https://kubernetes.io/docs/user-guide/compute-resources/
autoscalingobject{"controlledResources":["cpu","memory"],"controlledValues":"RequestsOnly","enabled":false,"maxAllowed":{},"minAllowed":{},"updatePolicy":{"updateMode":"InPlaceOrRecreate"}}Vertical pod autoscaler ref: https://kubernetes.io/docs/concepts/workloads/autoscaling/vertical-pod-autoscale/
autoscaling.controlledResourceslist["cpu","memory"]Resource to control Possible values are "cpu" and "memory"
autoscaling.controlledValuesstring"RequestsOnly"Controls which resource value should be autoscaled Possible values are "RequestsAndLimits" and "RequestsOnly"
autoscaling.maxAllowedobject{}Max allowed resources for the pod default is resources.limits
autoscaling.minAllowedobject{}Min allowed resources for the pod default is resources.requests
autoscaling.updatePolicyobject{"updateMode":"InPlaceOrRecreate"}Update policy Possible values are "Off", "Initial", "Recreate", "InPlaceOrRecreate" and "Auto"
useDaemonSetboolfalseUse a daemonset instead of a deployment
terminationGracePeriodSecondsint240
updateStrategyobject{"rollingUpdate":{"maxUnavailable":1},"type":"RollingUpdate"}pod deployment update strategy type. ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#updating-a-deployment
priorityClassNamestringnilPriority Class Name ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass
nodeSelectorobject{}Node labels for pod assignment. ref: https://kubernetes.io/docs/user-guide/node-selection/
tolerationslist[]Tolerations for pod assignment. ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
podAntiAffinityPresetstring"soft"Pod Anti Affinity soft/hard
affinityobject{}Affinity for pod assignment. ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
metrics.enabledboolfalse
metrics.image.repositorystring"jbub/pgbouncer_exporter"
metrics.image.tagstring"v0.22.0"
metrics.image.pullPolicystring"IfNotPresent"
metrics.resources.limits.cpustring"100m"
metrics.resources.limits.memorystring"32Mi"
metrics.resources.requests.cpustring"10m"
metrics.resources.requests.memorystring"16Mi"

Deploy pgbouncer with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has pgbouncer on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartpgbouncer is pinned at v0.20.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply