pgadmin4
by Helm
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: StatefulSetonly. 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
| Parameter | Description | Default |
|---|---|---|
global.imageRegistry | Global image pull registry for all images | "" |
global.imagePullSecrets | Global image pull secrets, support both full format (- name: secret) and short format (- secret) | [] |
nameOverride | Override the chart name used in resource names and labels | "" |
fullnameOverride | Override the full resource name | "" |
workload.kind | Workload type (Deployment or StatefulSet) | "Deployment" |
replicaCount | Number of pgadmin4 replicas | 1 |
image.registry | Docker image registry | "docker.io" |
image.repository | Docker image | "dpage/pgadmin4" |
image.tag | Docker image tag | "" |
image.pullPolicy | Docker image pull policy | "IfNotPresent" |
imagePullSecrets | Docker image pull secrets | [] |
annotations | Deployment Annotations | {} |
revisionHistoryLimit | The number of old history to retain to allow rollback | 10 |
commonLabels | Add labels to all the deployed resources | {} |
priorityClassName | Deployment priorityClassName | "" |
command | Container command override | [] |
args | Deployment arguments override | [] |
service.type | Service type (ClusterIP, NodePort or LoadBalancer) | "ClusterIP" |
service.clusterIP | Service type Cluster IP | "" |
service.loadBalancerIP | Service Load Balancer IP | "" |
service.port | Service port | 80 |
service.targetPort | Container port the Service targets, a number or a port name. Empty means the port named service.portName | "" |
service.portName | Name of the port on the service | "http" |
service.annotations | Service Annotations | {} |
service.nodePort | Kubernetes service nodePort | nil |
serviceAccount.create | Creates a ServiceAccount for the pod. | false |
serviceAccount.annotations | Annotations to add to the service account. | {} |
serviceAccount.name | The name of the service account. Otherwise uses the fullname. | "" |
serviceAccount.automountServiceAccountToken | Opt out of API credential automounting. | false |
hostAliases | Add entries to Pod /etc/hosts | [] |
strategy | Specifies the strategy used to replace old Pods by new ones | {} |
serverDefinitions.enabled | Enables Server Definitions | false |
serverDefinitions.resourceType | The type of resource to deploy server definitions (either ConfigMap or Secret) | "ConfigMap" |
serverDefinitions.existingConfigmap | The name of a configMap containing Server Definitions. Only used when serverDefinitions.resourceType is ConfigMap | "" |
serverDefinitions.existingSecret | The name of a Secret containing Server Definitions. Only used when serverDefinitions.resourceType is Secret | "" |
serverDefinitions.useStringData | When resourceType = Secret put raw JSON under stringData: instead of base-64 under data:. Useful for debugging | false |
serverDefinitions.annotations | Annotations for ConfigMap or Secret, if you are not using existing resources. Useful for cluster webhooks | {} |
serverDefinitions.servers | Pre-configured server parameters | nil |
preferences.enabled | Specify if to create preferences configmap and mount it | false |
preferences.existingConfigMap | The name of a configMap containing your Preferences | "" |
preferences.data | Preferences Data | {} |
networkPolicy.enabled | Enables Network Policy | true |
podDisruptionBudget.enabled | Creates a PodDisruptionBudget | false |
podDisruptionBudget.minAvailable | Pods that must stay available during voluntary disruptions | 1 |
podDisruptionBudget.maxUnavailable | Pods that may be unavailable at once. Takes precedence over minAvailable | nil |
httpRoute.enabled | Switches from standard Ingress to Gateway API HTTPRoute resource generation | false |
httpRoute.labels | Additional labels to add to the generated HTTPRoute resource metadata. | {} |
httpRoute.annotations | Key-value map for controller-specific metadata | {} |
httpRoute.hostnames | FQDNs 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.parentRefs | Binds 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.listenerSetSectionName | Optional 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.matches | Core routing rules (path/headers) and backendRefs; evaluated in order until a match occurs | [] |
listenerSet.enabled | Enables Gateway API ListenerSet resource generation | false |
listenerSet.labels | Additional labels to add to the generated ListenerSet resource metadata. | {} |
listenerSet.annotations | Key-value map for controller-specific metadata | {} |
listenerSet.parentRef | Gateway the listeners are attached to (name, and optionally namespace, group, kind) | {} |
listenerSet.listeners | Listeners to add to the parent Gateway (name, port, protocol, and optionally hostname, tls, allowedRoutes) | [] |
ingress.enabled | Enables Ingress | false |
ingress.ingressClassName | Ingress Class Name, e.g. nginx | "" |
ingress.annotations | Ingress annotations | {} |
ingress.labels | Custom labels | {} |
ingress.hosts | Ingress hosts, each with a host and a list of paths (path, pathType) | [{"host":"chart-example.local","paths":[{"path":"/","pathType":"Prefix"}]}] |
ingress.tls | Ingress TLS configuration | [] |
istioIngress.enabled | Enable Istio Gateway instead of Ingress | false |
istioIngress.selector | Label selector for Istio Ingress Gateway pods | "" |
istioIngress.endpoints | Hosts served by Istio Gateway | [""] |
istioIngress.tls.enabled | Enable TLS for Istio gateway | false |
istioIngress.tls.secretCertName | TLS certificate secret name | "my-istio-tls-secret" |
istioIngress.gateway.enabled | Enable Istio Gateway resource | false |
istioIngress.gateway.ports | Istio gateway ports configuration | {http: {...}, https: {...}} |
istioIngress.virtualService.enabled | Enable Istio VirtualService | false |
istioIngress.virtualService.gateway | VirtualService gateway name | "" |
istioIngress.virtualService.config | VirtualService routing config | {} |
extraConfigmapMounts | Additional configMap volume mounts for pgadmin4 pod | [] |
pgpass.existingSecret | Existing 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.key | Key in pgpass.existingSecret that holds the pgpass file | "pgpass" |
extraSecretMounts | Additional secret volume mounts for pgadmin4 pod | [] |
extraVolumeMounts | Additional volume mounts for the pgadmin4 container | [] |
extraContainers | Sidecar containers to add to the pgadmin4 pod | "" |
existingSecret | The name of an existing secret containing the pgadmin4 default password and, optionally, Server Definitions. | "" |
secretKeys.pgadminPasswordKey | Name of key in existing secret to use for default pgadmin credentials. Only used when existingSecret is set. | "password" |
env.email | pgAdmin4 default email. Needed chart reinstall for apply changes | "[email protected]" |
env.password | pgAdmin4 default password. Needed chart reinstall for apply changes | "SuperSecret" |
env.pgpassfile | Path to a pgpass file, e.g. /var/lib/pgadmin/storage/pgadmin/file.pgpass. Defaults to /pgpass/pgpass when pgpass.existingSecret is set | "" |
env.contextPath | Context path for serving pgAdmin under a URL prefix, e.g. /pgadmin4 | "" |
env.enhanced_cookie_protection | Allows pgAdmin4 to create session cookies based on IP address | "False" |
env.variables | Additional environment variables as a list of name/value pairs | [] |
envVarsFromConfigMaps | Array of ConfigMap names to load as environment variables | [] |
envVarsFromSecrets | Array of Secret names to load as environment variables | [] |
envVarsExtra | Array of arbitrary environment variable definitions (e.g., for fetching from Kubernetes Secrets) | [] |
persistentVolume.enabled | If true, pgAdmin4 will create a Persistent Volume Claim | true |
persistentVolume.annotations | Persistent Volume Claim annotations | {} |
persistentVolume.accessModes | Persistent Volume access modes | [ReadWriteOnce] |
persistentVolume.size | Persistent Volume size | "10Gi" |
persistentVolume.storageClass | Persistent Volume Storage Class. - sets an empty storageClassName; empty uses the cluster default | "" |
persistentVolume.existingClaim | Persistent Volume existing claim name | "" |
persistentVolume.subPath | Subdirectory of the volume to mount at | "" |
extraVolumes | Additional volumes for the pgadmin4 pod | [] |
securityContext | Custom 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartpgadmin4 is pinned at v1.72.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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