pgadmin4

by Helm

Helm chartv1.72.0App 9.19Apache-2.0Verified publisher

pgAdmin4 is a web based administration tool for PostgreSQL database

About this chart

based on [dpage/pgadmin4]

pgAdmin 4

pgAdmin4 is the leading Open Source management tool for Postgres, the world’s most advanced Open Source database. pgAdmin4 is designed to meet the needs of both novice and experienced Postgres users alike, providing a powerful graphical interface that simplifies the creation, maintenance and use of database objects.

Prerequisites

  • Kubernetes 1.19+
  • Helm 3.7+

TL;DR

helm repo add runix https://helm.runix.net
helm install pgadmin4 runix/pgadmin4

Introduction

This chart bootstraps a pgAdmin4 deployment on a Kubernetes cluster using the Helm package manager.

Install the Chart

To install the chart with the release name my-release:

helm install my-release runix/pgadmin4

The command deploys pgAdmin4 on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

Tip: List all releases using helm list

Upgrading

To 1.67.0

Breaking for workload.kind: StatefulSet only. Deployment installs, the default, upgrade as usual.

Before 1.67.0, the StatefulSet volumeClaimTemplates carried the chart and app version labels. Kubernetes does not allow changes to volumeClaimTemplates, so every upgrade of a StatefulSet install failed with spec.volumeClaimTemplates: ... field is immutable. From 1.67.0 on, volumeClaimTemplates only carry labels that never change.

To upgrade a StatefulSet install to 1.67.0, delete the StatefulSet without deleting its pods and PVCs, then upgrade:

kubectl delete statefulset -n <namespace> -l app.kubernetes.io/instance=<release> --cascade=orphan
helm upgrade -n <namespace> <release> runix/pgadmin4 --version 1.67.0

The new StatefulSet adopts the running pod and the existing PVC, so your data stays. You only need this step once.

Good to know

Default login and server definitions apply on first start only

pgAdmin reads env.email, the default password, and serverDefinitions only when it creates its configuration database, on the first start with an empty /var/lib/pgadmin. With persistentVolume.enabled, later changes to these values have no effect on the existing volume. Change the login in pgAdmin itself, or start over with a new volume.

Certificates outside pgAdmin storage

In server mode, pgAdmin only reads certificate files, such as sslrootcert, from its storage directory. To use certificates that something else mounts at a fixed path, for example autocert at /var/run/autocert.step.sm, register that directory with PGADMIN_CONFIG_SHARED_STORAGE and refer to files as <name>:/<file>. See examples/certificates-from-another-volume.yaml.

Running behind more than one proxy

pgAdmin trusts the X-Forwarded-* headers of one proxy. Behind two, such as a cloud load balancer in front of the ingress controller, it builds http:// URLs and OAuth2 providers reject the redirect URI. Set PGADMIN_CONFIG_PROXY_X_FOR_COUNT, PGADMIN_CONFIG_PROXY_X_PROTO_COUNT, and PGADMIN_CONFIG_PROXY_X_HOST_COUNT to the number of proxies, as in examples/behind-multiple-proxies.yaml.

Hardening

To run pgAdmin under the Kubernetes restricted Pod Security Standard, use:

containerPorts:
  http: 8080
containerSecurityContext:
  enabled: true
  allowPrivilegeEscalation: false
  runAsNonRoot: true
  readOnlyRootFilesystem: true
  capabilities:
    drop:
      - ALL
  seccompProfile:
    type: RuntimeDefault

Without privilege escalation, pgAdmin cannot bind port 80, so it listens on containerPorts.http instead. The Service keeps port 80 and targets the container port by name. With readOnlyRootFilesystem, the chart mounts emptyDirs at /tmp and /var/log/pgadmin unless extraVolumeMounts already covers those paths. CI installs and upgrades these values on every change (ci/hardened-values.yaml).

Uninstall the Chart

To uninstall/delete the my-release deployment:

helm delete --purge my-release

The command removes nearly all the Kubernetes components associated with the chart and deletes the release.

Configuration

ParameterDescriptionDefault
global.imageRegistryGlobal image pull registry for all images""
global.imagePullSecretsGlobal image pull secrets, support both full format (- name: secret) and short format (- secret)[]
nameOverrideOverride the chart name used in resource names and labels""
fullnameOverrideOverride the full resource name""
workload.kindWorkload type (Deployment or StatefulSet)"Deployment"
replicaCountNumber of pgadmin4 replicas1
image.registryDocker image registry"docker.io"
image.repositoryDocker image"dpage/pgadmin4"
image.tagDocker image tag""
image.pullPolicyDocker image pull policy"IfNotPresent"
imagePullSecretsDocker image pull secrets[]
annotationsDeployment Annotations{}
revisionHistoryLimitThe number of old history to retain to allow rollback10
commonLabelsAdd labels to all the deployed resources{}
priorityClassNameDeployment priorityClassName""
commandContainer command override[]
argsDeployment arguments override[]
service.typeService type (ClusterIP, NodePort or LoadBalancer)"ClusterIP"
service.clusterIPService type Cluster IP""
service.loadBalancerIPService Load Balancer IP""
service.portService port80
service.targetPortContainer port the Service targets, a number or a port name. Empty means the port named service.portName""
service.portNameName of the port on the service"http"
service.annotationsService Annotations{}
service.nodePortKubernetes service nodePortnil
serviceAccount.createCreates a ServiceAccount for the pod.false
serviceAccount.annotationsAnnotations to add to the service account.{}
serviceAccount.nameThe name of the service account. Otherwise uses the fullname.""
serviceAccount.automountServiceAccountTokenOpt out of API credential automounting.false
hostAliasesAdd entries to Pod /etc/hosts[]
strategySpecifies the strategy used to replace old Pods by new ones{}
serverDefinitions.enabledEnables Server Definitionsfalse
serverDefinitions.resourceTypeThe type of resource to deploy server definitions (either ConfigMap or Secret)"ConfigMap"
serverDefinitions.existingConfigmapThe name of a configMap containing Server Definitions. Only used when serverDefinitions.resourceType is ConfigMap""
serverDefinitions.existingSecretThe name of a Secret containing Server Definitions. Only used when serverDefinitions.resourceType is Secret""
serverDefinitions.useStringDataWhen resourceType = Secret put raw JSON under stringData: instead of base-64 under data:. Useful for debuggingfalse
serverDefinitions.annotationsAnnotations for ConfigMap or Secret, if you are not using existing resources. Useful for cluster webhooks{}
serverDefinitions.serversPre-configured server parametersnil
preferences.enabledSpecify if to create preferences configmap and mount itfalse
preferences.existingConfigMapThe name of a configMap containing your Preferences""
preferences.dataPreferences Data{}
networkPolicy.enabledEnables Network Policytrue
podDisruptionBudget.enabledCreates a PodDisruptionBudgetfalse
podDisruptionBudget.minAvailablePods that must stay available during voluntary disruptions1
podDisruptionBudget.maxUnavailablePods that may be unavailable at once. Takes precedence over minAvailablenil
httpRoute.enabledSwitches from standard Ingress to Gateway API HTTPRoute resource generationfalse
httpRoute.labelsAdditional labels to add to the generated HTTPRoute resource metadata.{}
httpRoute.annotationsKey-value map for controller-specific metadata{}
httpRoute.hostnamesFQDNs for Layer 7 matching. If empty, matches all hostnames on the parent Gateway/ListenerSet listeners (no need to set them when listenerSet.enabled is true)[]
httpRoute.parentRefsBinds this route to specific Gateway resources (name/namespace), enabling the data plane attachment. If empty and listenerSet.enabled is true, the route attaches to the chart's ListenerSet[]
httpRoute.listenerSetSectionNameOptional listener name of the chart's ListenerSet to attach to (only used when parentRefs is empty and listenerSet.enabled is true). Attaches to all listeners if empty""
httpRoute.matchesCore routing rules (path/headers) and backendRefs; evaluated in order until a match occurs[]
listenerSet.enabledEnables Gateway API ListenerSet resource generationfalse
listenerSet.labelsAdditional labels to add to the generated ListenerSet resource metadata.{}
listenerSet.annotationsKey-value map for controller-specific metadata{}
listenerSet.parentRefGateway the listeners are attached to (name, and optionally namespace, group, kind){}
listenerSet.listenersListeners to add to the parent Gateway (name, port, protocol, and optionally hostname, tls, allowedRoutes)[]
ingress.enabledEnables Ingressfalse
ingress.ingressClassNameIngress Class Name, e.g. nginx""
ingress.annotationsIngress annotations{}
ingress.labelsCustom labels{}
ingress.hostsIngress hosts, each with a host and a list of paths (path, pathType)[{"host":"chart-example.local","paths":[{"path":"/","pathType":"Prefix"}]}]
ingress.tlsIngress TLS configuration[]
istioIngress.enabledEnable Istio Gateway instead of Ingressfalse
istioIngress.selectorLabel selector for Istio Ingress Gateway pods""
istioIngress.endpointsHosts served by Istio Gateway[""]
istioIngress.tls.enabledEnable TLS for Istio gatewayfalse
istioIngress.tls.secretCertNameTLS certificate secret name"my-istio-tls-secret"
istioIngress.gateway.enabledEnable Istio Gateway resourcefalse
istioIngress.gateway.portsIstio gateway ports configuration{http: {...}, https: {...}}
istioIngress.virtualService.enabledEnable Istio VirtualServicefalse
istioIngress.virtualService.gatewayVirtualService gateway name""
istioIngress.virtualService.configVirtualService routing config{}
extraConfigmapMountsAdditional configMap volume mounts for pgadmin4 pod[]
pgpass.existingSecretExisting Secret with a pgpass file. An init container copies it into the pod with mode 0600 and the chart sets PGPASSFILE, unless env.pgpassfile is set""
pgpass.keyKey in pgpass.existingSecret that holds the pgpass file"pgpass"
extraSecretMountsAdditional secret volume mounts for pgadmin4 pod[]
extraVolumeMountsAdditional volume mounts for the pgadmin4 container[]
extraContainersSidecar containers to add to the pgadmin4 pod""
existingSecretThe name of an existing secret containing the pgadmin4 default password and, optionally, Server Definitions.""
secretKeys.pgadminPasswordKeyName of key in existing secret to use for default pgadmin credentials. Only used when existingSecret is set."password"
env.emailpgAdmin4 default email. Needed chart reinstall for apply changes"[email protected]"
env.passwordpgAdmin4 default password. Needed chart reinstall for apply changes"SuperSecret"
env.pgpassfilePath to a pgpass file, e.g. /var/lib/pgadmin/storage/pgadmin/file.pgpass. Defaults to /pgpass/pgpass when pgpass.existingSecret is set""
env.contextPathContext path for serving pgAdmin under a URL prefix, e.g. /pgadmin4""
env.enhanced_cookie_protectionAllows pgAdmin4 to create session cookies based on IP address"False"
env.variablesAdditional environment variables as a list of name/value pairs[]
envVarsFromConfigMapsArray of ConfigMap names to load as environment variables[]
envVarsFromSecretsArray of Secret names to load as environment variables[]
envVarsExtraArray of arbitrary environment variable definitions (e.g., for fetching from Kubernetes Secrets)[]
persistentVolume.enabledIf true, pgAdmin4 will create a Persistent Volume Claimtrue
persistentVolume.annotationsPersistent Volume Claim annotations{}
persistentVolume.accessModesPersistent Volume access modes[ReadWriteOnce]
persistentVolume.sizePersistent Volume size"10Gi"
persistentVolume.storageClassPersistent Volume Storage Class. - sets an empty storageClassName; empty uses the cluster default""
persistentVolume.existingClaimPersistent Volume existing claim name""
persistentVolume.subPathSubdirectory of the volume to mount at""
extraVolumesAdditional volumes for the pgadmin4 pod[]
securityContextCustom pod security context for pgAdmin4 pod``
`containerSecuri

Deploy pgadmin4 with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has pgadmin4 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 chartpgadmin4 is pinned at v1.72.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