Skip to main content
πŸŽ“ Claude Code Masterclass Learn AI-assisted development on Udemy β€” plus the companion book on Leanpub & Amazon. Start Learning
Harbor: Enterprise Container Registry on Kubernetes
DevOps

Harbor: Enterprise Container Registry on Kubernetes

Deploy Harbor for vulnerability scanning, image signing, replication, RBAC, and Helm chart hosting β€” the CNCF graduated registry.

LB
Luca Berton
Β· 1 min read

What Is Harbor?

Harbor is an enterprise container registry with vulnerability scanning, image signing, replication, and RBAC. CNCF Graduated, 25K+ GitHub stars.

Harbor vs Docker Hub vs ECR

FeatureHarborDocker HubECR/GCR/ACR
Self-hostedβœ…βŒβŒ
Vulnerability scanningβœ… (Trivy)⚠️ Paidβœ…
Image signingβœ… (Cosign/Notary)❌⚠️
Replicationβœ… (multi-site)❌⚠️ (cross-region)
RBACβœ… Fine-grained⚠️ Basicβœ…
Helm chartsβœ…βŒβš οΈ
Quotasβœ… Per-projectπŸ’°βœ…
Cost$0 + infra$7-25/moPer-GB

Helm Installation

helm repo add harbor https://helm.goharbor.io
helm install harbor harbor/harbor \
  --namespace harbor \
  --create-namespace \
  --set expose.type=ingress \
  --set expose.ingress.hosts.core=registry.yourdomain.com \
  --set expose.tls.certSource=secret \
  --set persistence.persistentVolumeClaim.registry.size=500Gi \
  --set persistence.persistentVolumeClaim.database.size=50Gi \
  --set harborAdminPassword=your-secure-password \
  --set trivy.enabled=true

Key Features

Automatic Vulnerability Scanning

Every pushed image is scanned with Trivy:

# Push triggers automatic scan
docker push registry.yourdomain.com/myproject/api:v1.2.3

# Harbor blocks pull if critical CVEs found (configurable)
# Policy: prevent deployment of images with Critical/High CVEs

Image Signing (Supply Chain Security)

# Sign with Cosign
cosign sign --key cosign.key registry.yourdomain.com/myproject/api:v1.2.3

# Kubernetes admission controller verifies signatures
# Only signed images can run in production namespaces

Replication (Multi-Site)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Harbor EU   │◀──sync──▢│  Harbor US   β”‚
β”‚  (primary)   β”‚         β”‚  (replica)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β”‚  push from CI/CD
       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
β”‚  Developers β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Images replicated across regions for HA and faster pulls.

Garbage Collection

# Schedule GC to reclaim storage from deleted tags
# Harbor Admin β†’ Configuration β†’ Garbage Collection β†’ Schedule
# Recommended: weekly, during low-traffic hours

Integration with Kubernetes

# ImagePullSecret for Harbor
apiVersion: v1
kind: Secret
metadata:
  name: harbor-registry
type: kubernetes.io/dockerconfigjson
data:
  .dockerconfigjson: <base64-encoded-config>
---
# Pod spec
spec:
  imagePullSecrets:
    - name: harbor-registry
  containers:
    - name: app
      image: registry.yourdomain.com/production/api:v1.2.3

Storage Sizing

ImagesTags/ImageAvg SizeTotal Storage
5010500MB250GB
20020500MB2TB
500301GB15TB

Enable layer deduplication β€” reduces actual storage by 40-60%.

Free 30-min AI & Cloud consultation

Book Now