harbor
A modern, production-ready Helm chart for [Harbor distribution 8gcr](https://github.com/container-registry/8gcr) - the cloud-native container registry for Kubernetes.
About this chart
harbor
A modern, production-ready Helm chart for Harbor distribution 8gcr - the cloud-native container registry for Kubernetes.
TL;DR
# Provide DB credentials via a Secret instead of --set (process list + shell history leak)
kubectl create secret generic my-harbor-db \
--from-literal=POSTGRESQL_PASSWORD='your-strong-password'
helm install my-harbor oci://8gears.container-registry.com/8gcr/charts/harbor \
--set externalURL=https://harbor.example.com \
--set database.host=my-postgres.example.com \
--set database.existingSecret=my-harbor-db
⚠️ Security: Harbor's default admin credentials (
admin/Harbor12345) are publicly known. Set a strong password viaharborAdminPassword(or, better, a Kubernetes Secret referenced byexistingSecretAdminPassword) and rotate it after the first login.
Why This Chart?
This chart is a ground-up redesign of the Harbor Helm chart with modern Kubernetes best practices, built for 8gcr:
| Feature | Legacy harbor-helm | This Chart |
|---|---|---|
| Configuration | 70+ helper templates, hardcoded env vars | toEnvVars pattern — any config works |
| Database | Built-in PostgreSQL StatefulSet | External only (production best practice) |
| Redis | Built-in Redis Deployment | Valkey subchart or external |
| Ingress | nginx reverse proxy + Ingress | Direct Ingress/Gateway API |
| Security | Basic security context | PSS Restricted profile compliant |
| Validation | None | JSON Schema validation |
| Resource Defaults | None (comments only) | Sensible defaults for all components |
| PodDisruptionBudget | Not available | Per-component PDB support |
| Templates | 48 files, 607-line helpers | 43 files, ~800-line helpers |
| values.yaml | 1,116 lines | ~1,150 lines (317 helm-docs annotations) |
Key Features
Future-Proof Configuration with toEnvVars
The chart uses a unique toEnvVars pattern that converts nested YAML configuration to flat environment variables. This means any Harbor configuration option works without chart updates:
core:
config:
# These become CONFIG_KEY and NESTED_VALUE env vars
config_key: "value"
nested:
value: "something"
secret:
# These become secrets (base64 encoded)
sensitive_data: "secret-value"
Production-Ready Security
All containers run with Pod Security Standards (PSS) Restricted profile:
runAsNonRoot: true— No root containersreadOnlyRootFilesystem: true— Immutable container filesystemallowPrivilegeEscalation: false— No privilege escalationcapabilities.drop: ["ALL"]— No Linux capabilitiesseccompProfile.type: RuntimeDefault— Seccomp filtering enabled
High Availability Ready
- PodDisruptionBudgets — Ensure availability during node maintenance
- Resource requests/limits — Guaranteed QoS with sensible defaults
- Affinity/Anti-affinity — Control pod placement
- Multiple replicas — Scale any component horizontally
Flexible Ingress Options
- Standard Kubernetes Ingress (default)
- Gateway API HTTPRoute (modern alternative)
- extraManifests for custom routing (Traefik IngressRoute, etc.)
Schema Validation
Built-in values.schema.json provides:
- IDE autocompletion and validation
- Required field enforcement (
externalURL,database.host) - Type checking and enum validation
- Immediate feedback on configuration errors
- Typo detection: unknown top-level keys are rejected
(
additionalProperties: falseat the root). Component config blocks stay open by design — the generic passthrough means new application config keys never require a chart change.
Architecture
Prerequisites
- Kubernetes 1.28+ (we follow endoflife.date/kubernetes for supported versions)
- Helm 3.x
- External PostgreSQL database (required)
- PV provisioner (for filesystem storage)
Installing the Chart
Basic Installation
# Pre-create the DB credential and admin Secrets so passwords never appear on the CLI
kubectl create namespace harbor
kubectl -n harbor create secret generic my-harbor-db \
--from-literal=POSTGRESQL_PASSWORD='your-strong-db-password'
kubectl -n harbor create secret generic my-harbor-admin \
--from-literal=HARBOR_ADMIN_PASSWORD='your-strong-admin-password'
helm install my-harbor oci://8gears.container-registry.com/8gcr/charts/harbor \
--namespace harbor \
--set externalURL=https://harbor.example.com \
--set database.host=postgres.example.com \
--set database.existingSecret=my-harbor-db \
--set existingSecretAdminPassword=my-harbor-admin
With Values File
helm install my-harbor oci://8gears.container-registry.com/8gcr/charts/harbor \
--namespace harbor \
--create-namespace \
-f values-production.yaml
Configuration
Required Values
| Key | Description |
|---|---|
externalURL | Public URL for Harbor (e.g., https://harbor.example.com) |
database.host | PostgreSQL host |
database.password | PostgreSQL password (or use database.existingSecret) |
Image source and registry
By default the chart pulls the 8gcr images. Switch every component to
the upstream goharbor images (docker.io/goharbor/*) with a single value:
image:
source: upstream # 8gcr (default) | upstream
Override an individual image with <component>.image.{registry,repository,tag,digest}
— repository is the path without the registry host, and digest pins by
sha256 instead of the tag. For an air-gapped mirror, set global.imageRegistry
to override the host for all images at once; it preserves the repository
path and wins over image.source. See
example/upstream-goharbor/.
Component Configuration
Each Harbor component (core, portal, registry, jobservice, exporter) supports:
| Key | Description |
|---|---|
<component>.replicas | Number of replicas (ignored when autoscaling.enabled=true) |
<component>.autoscaling | enabled/minReplicas/maxReplicas/CPU+memory targets — see HPA section |
<component>.resources | CPU/memory requests and limits |
<component>.config | Application config (becomes ConfigMap env vars) |
<component>.secret | Sensitive config (becomes Secret env vars) |
<component>.extraEnv | Additional env vars with valueFrom support |
<component>.lifecycle | Container preStop/postStart hook spec — see Lifecycle hooks |
<component>.probes | Full K8s probe specs (startup/liveness/readiness), rendered verbatim. Defaults: 2s-period startupProbe (ready as soon as the endpoint responds, no fixed initialDelay), 5s readiness, 10s liveness. Set a probe to null to omit it |
<component>.hostAliases | /etc/hosts entries (list of {ip, hostnames}) for private DNS targets |
<component>.pdb.enabled | Enable PodDisruptionBudget |
<component>.pdb.minAvailable | Minimum available pods during disruption |
<component>.affinity | Pod affinity rules |
<component>.nodeSelector | Node selection constraints |
<component>.tolerations | Pod tolerations |
<component>.securityContext | Container security context |
<component>.podSecurityContext | Pod security context |
<component>.serviceAccount.create | Create dedicated ServiceAccount |
Default Resource Allocations
| Component | CPU Request | Memory Request | Memory Limit |
|---|---|---|---|
| Core | 100m | 256Mi | 512Mi |
| Registry | 100m | 256Mi | 512Mi |
| Portal | 100m | 128Mi | 256Mi |
| Jobservice | 100m | 256Mi | 512Mi |
| Exporter | 100m | 128Mi | 256Mi |
Example Values Files
The example/ directory contains one directory per scenario, each with a ready-to-use values.yaml (every one is render-checked in CI):
| Directory | Description |
|---|---|
k3d-local/ | Local development with k3d cluster |
rke2-rancher/ | RKE2/Rancher deployment |
private-ca/ | Private-CA / mTLS: PG with verify-full + Redis over TLS + shared CA for S3/OIDC |
openshift/ | OpenShift deployment with edge-terminated routes |
aws-eks-irsa/ | AWS EKS with IRSA for S3 storage and RDS IAM Auth |
flux/ | FluxCD GitOps: HelmRelease + drift detection + pinned secrets (autoGenSecrets: false), works for Argo CD too |
argocd/ | Argo CD Application: OCI chart + $values git source, pinned secrets (autoGenSecrets: false is mandatory under client-side rendering) |
helm install harbor . -n harbor --create-namespace -f example/k3d-local/values.yaml
Configuration Examples
Production Setup with High Availability
externalURL: https://harbor.example.com
# External database (required)
database:
host: postgres.example.com
password: your-db-password
sslmode: require
# HA: PDB + autoscaling. `replicas:` is ignored once autoscaling kicks
# in — the HPA owns the count and the Deployment template OMITS the
# field so helm upgrade does not fight the HPA on every roll-out.
core:
pdb:
enabled: true
minAvailable: 1
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 10
targetCPUUtilizationPercentage: 70
resources:
requests:
cpu: 200m
memory: 512Mi
limits:
memory: 1Gi
portal:
pdb:
enabled: true
minAvailable: 1
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 6
targetCPUUtilizationPercentage: 70
registry:
pdb:
enabled: true
minAvailable: 1
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 8
targetCPUUtilizationPercentage: 70
# Ingress with TLS
ingress:
enabled: true
className: nginx
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
hosts:
- host: harbor.example.com
paths:
- path: /
pathType: Prefix
tls:
- secretName: harbor-tls
hosts:
- harbor.example.com
# Use Valkey for Redis
valkey:
enabled: true
architecture: standalone
Registry configuration (YAML passthrough)
registry.config accepts the full distribution/distribution config.yml schema verbatim — every key distribution supports works without chart changes. The chart wholesale renders this block into /etc/registry/config.yml, merging only a small set of chart-managed runtime values (redis, log.level, http.addr/debug) on top via Helm mustMergeOverwrite. User keys always win on collision.
Three customization tiers:
- Default — ship-shape filesystem backend out of the box, no override needed.
- Inline — edit
registry.configin your values file. - External ConfigMap — own
config.ymloutside the chart entirely.
Switching storage backend — set exactly one driver key under storage:. The chart default deliberately ships no driver, so your s3: can't collide with a chart-side filesystem: (Helm deep-merge). When no driver is set, the chart injects filesystem: {rootdirectory: /storage} at render time; defining two or more drivers fails at helm install/template time with a message naming them — instead of distribution CrashLooping at boot:
registry:
config:
storage:
s3:
region: us-east-1
bucket: my-harbor-bucket
# forcepathstyle: true # MinIO / Ceph RGW / SeaweedFS
Credentials never go in registry.config (they'd be visible in the rendered ConfigMap). Use one of:
- BYO Secret (recommended) —
registry.storageCredentials.<backend>.existingSecretreferences a pre-existing Secret. The chart injectsREGISTRY_STORAGE_<BACKEND>_<KEY>env vars on both the registry container and the registryctl sidecar (registryctl runs garbage collection and needs the same creds). Distribution honors these env overrides for any config.yml field. - Inline (dev) —
registry.secret: { REGISTRY_STORAGE_S3_ACCESSKEY: <plain> }gets b64-encoded into the chart-generated Secret and injected viaenvFrom.
S3 Storage Backend
registry:
config:
storage:
s3:
regio
Deploy harbor with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has harbor 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 chartharbor is pinned at v2.2.1 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