Kubernetes private container registry with Harbor

Running Harbor as the in-house registry for cluster images, with access control, scanning before deployment, replication to air-gapped sites and kubeadm pointed at a private registry.

On this page

Why teams run a private Kubernetes container registry with Harbor

Teams run a private registry when their clusters cannot pull freely from public registries, or when policy requires images, scan results and deployment sources to stay inside their own boundary. For that job, this page uses Harbor as the self-hosted registry. Harbor extends the open-source Distribution registry with projects and role-based access control, LDAP/AD and OIDC single sign-on, Trivy vulnerability scanning, garbage collection and audit logs, all managed through a REST API. Harbor stores container images and Helm charts as OCI artifacts, since v2.8.0 no longer ships ChartMuseum, so one registry can serve both the images a cluster runs and the charts used to deploy them.

This page covers the registry itself: how it is installed, how projects and identities are set up, how images are scanned and replicated, and how clusters are pointed at it. It does not cover building the Kubernetes cluster, which is handled in the distribution and installation section. Before scoping the work, confirm with your team which Harbor release line you will standardize on, since the Harbor documentation covers v2.15.0 and later patch releases carry breaking changes that affect webhooks and content trust. Also confirm whether your identity provider supports OIDC or only LDAP/AD, because that choice shapes how project roles are assigned.

Harbor is licensed under Apache-2.0, and the CNCF project page records that it joined the CNCF on July 31, 2018, moved to incubating on November 14, 2018 and reached the Graduated maturity level on June 15, 2020. Those dates matter to procurement teams that check project governance and long-term support. Licensing does not replace the work of operating the registry, so budget for ownership of storage, backups, upgrades and the separate question of who approves what enters the registry.

What you need before installing Harbor for your clusters

Harbor sits between your build pipeline and every cluster that pulls images, so its prerequisites decide whether the registry is reachable, trusted and recoverable. The cards below cover the Harbor version to target, the platform it runs on, DNS and certificates, identity, and the kubeadm control planes that must reach it. Check each item with the owners of that layer before the installer runs.

Target Harbor version

Start from v2.15.4, the latest stable release, or the maintained 2.14 and 2.13 patch lines if your change window requires them. v2.15.2 moves the bundled internal database from PostgreSQL 15 to PostgreSQL 18 on container startup and replaces Redis with Valkey, so plan a backup and a rehearsal before upgrading an existing instance. v2.15.3 blocks webhooks to internal network addresses by default and fails signing of unsigned images in projects that enforce content trust. Read the release notes for the exact version you pick.

Harbor releases

Host and installer prerequisites

Confirm the CPU, memory, disk and container runtime requirements in the installation prerequisites for the release you chose, then decide between the Docker Compose installer and the Helm chart for a high availability deployment. Size the storage for image layers, the bundled database and scanner data separately, because image growth and scan databases behave differently. Confirm whether you need the --with-trivy option at install time, since vulnerability scanning depends on it.

Installation prerequisites

DNS and TLS certificates

Pick one fully qualified name for the registry and create it in DNS before installation, because every node that pulls images will resolve it. Issue a certificate from an authority your clusters and build agents already trust, and include the registry name in its subject alternative names. Plan certificate renewal as an operational task with an owner, since expired certificates stop image pulls across every cluster at once. Confirm the trust chain on each node, including air-gapped sites that have no public certificate authority access.

Identity provider for registry access

Decide how people and robot accounts authenticate before the first login. Harbor supports LDAP or Active Directory and OIDC single sign-on, so confirm which directory is the source of truth and which groups map to project roles. Keep a local administrator account for recovery and store its credentials in your secrets platform. Pipeline access should use robot accounts with narrow project permissions rather than shared human credentials.

Database and storage sizing

Estimate storage for images, Helm charts stored as OCI artifacts, scan results and the bundled PostgreSQL data before you choose volumes. Ask the installer documentation for the storage class and volume sizes that match your release, and confirm whether your team will run an external database instead of the bundled one. Set garbage collection and retention expectations early, because deleted images only free disk space after a garbage collection run.

Kubeadm control plane image access

Before any cluster can use the registry, its control plane images must be available. Run kubeadm config images list against the target Kubernetes version to see which images are needed, then pull them with kubeadm config images pull on a machine that has internet access. Push them into Harbor, then pass --image-repository to kubeadm init so the control plane pulls from your registry. Confirm the image tags match the version you are installing.

kubeadm init docs

How to install Harbor and point kubeadm at it

This sequence takes you from choosing a Harbor install route to a cluster whose control plane images come from your own registry. Each step ends with a check you can run before moving on.

  1. Choose the Harbor installer or Helm route

    Your platform team decides between the Harbor installer and a Helm-based deployment before any host is touched. The installation prerequisites and the installer download pages list the host, storage and network requirements for each route, and the Harbor HA Helm guide covers the high availability variant on Kubernetes. Record the chosen version, which the Harbor documentation covers as v2.15.0, and confirm the current patch release on the Harbor GitHub releases page before you install. You are done when the route, version and hosting location are written down and approved by the team that owns the registry.

  2. Install Harbor with Trivy enabled

    The Harbor administrator runs the installer on the chosen hosts and includes the --with-trivy option so that image vulnerability scanning is available from the start. Set the admin password, the external hostname and the TLS certificate in the configuration file before starting services, because changing them later affects every client. If you use the Helm route, enable the equivalent Trivy setting in the chart values. You are done when the Harbor web interface loads over HTTPS and the Trivy component reports as running in the service status.

  3. Create projects and access control

    Create one or more Harbor projects for the cluster control plane images, and set each project to private so anonymous pulls are refused. Create robot accounts or user groups for the build pipeline and for the cluster nodes, and grant each only the role it needs, such as pull-only for nodes. Connect LDAP, Active Directory or OIDC single sign-on if your identity team has approved it, so that access follows existing groups. You are done when a test user with the pull-only role can pull from the project and is refused a push.

  4. Log in and confirm the registry is reachable

    From an admin workstation and from a cluster node, run a Docker or container runtime login against the Harbor hostname using the robot or user credentials created in the previous step. Confirm that the TLS certificate chain is trusted on the node, because kubeadm will fail on certificate errors. Push a small test image to the project to confirm write access for the build role. You are done when the login succeeds from the node and the test image appears in the Harbor project.

  5. Scan the mirrored images before use

    Run a vulnerability scan on the test image and on the control plane images once they are pushed, and review the findings against your patch and exception policy. Harbor performs static analysis through Trivy, so scanning results appear in the artifact view after the scan completes. Decide whether a scan result blocks pulls in a project, and configure that policy before the cluster is built. You are done when every control plane image in the project shows a completed scan with a recorded result.

  6. Mirror control plane images with kubeadm

    On a host with access to the public image source, run kubeadm config images list with the target Kubernetes version to print the control plane image names, then kubeadm config images pull to download them. Retag each image to the Harbor hostname and project path, and push it to the private project. Keep the list of tags alongside the cluster build record so the same versions can be reproduced later. You are done when kubeadm config images list shows the expected tags and each one is present in the Harbor project.

  7. Run kubeadm init with the private registry

    On the first control plane node, run kubeadm init with the --image-repository flag set to the Harbor project path, so that kubeadm pulls its images from your registry rather than the public source. Pass the same Kubernetes version you mirrored and the control plane endpoint planned for your load balancer. Watch the pre-flight output for image pull errors, which usually point to missing tags, wrong project paths or certificate trust problems on the node. You are done when kubeadm reports a successful control plane initialization and kubectl get pods in the kube-system namespace shows the control plane components running from the Harbor project path.

  8. Confirm pulls come from the private project

    Check that the control plane pods use images from the Harbor hostname, and that joining nodes can also pull from the project. For application workloads, create image pull secrets in each namespace that references the Harbor robot account, and reference them from the pod specifications or the namespace default service account. Test one workload deployment end to end. You are done when a workload pulls its image from the private Harbor project without anonymous access and the pull appears in the Harbor project logs.

How Harbor projects, roles and single sign-on map to your teams

Harbor's access model starts with the project, so the role model should be designed for each project before any team is onboarded. A project groups the repositories, images and OCI artifacts that belong to one application or team, and users or groups receive a role inside that project. Changing roles after teams have already pushed images means reviewing many grants at once. For each project, write down who may pull, who may push, who may manage members and who may change settings such as scanning and retention. Confirm the built-in role names and their permissions in the Harbor documentation for the version you deploy, because the role set and its defaults can change between releases.

Single sign-on connects your directory to those project roles. Harbor supports LDAP/AD and OIDC, so group membership in your identity provider can be mapped to a Harbor role in a given project. Decide the group-to-role mapping per project, use group names that make the mapping easy to audit, and confirm whether any group should receive more than pull access. After onboarding, sign in as a test user from each group and check the role they receive. Also confirm how a removed group membership takes effect in your configuration, since a user may keep access until a sync or a new sign-in occurs, depending on how the integration is set up.

Cluster nodes and CI pipelines should never use a person's account. Create separate service identities for each purpose: a pull-only identity that backs the image pull secrets in each namespace that needs images, and a push-capable identity for CI that is limited to the projects it publishes to. Because each pull secret references a credential in a single namespace, an identity scoped to one project limits what a compromised workload can reach. As an illustrative check, attempt a pull from a namespace using a project it should not reach and confirm Harbor denies it. Record who owns each service identity and set a rotation schedule for its credentials.

Which identities and objects map between Kubernetes and Harbor

This table shows which identity and registry objects correspond between a Kubernetes cluster and Harbor, and what each mapping depends on in your environment. Read each row as a decision point: the Harbor object on the right is what your cluster, CI system or upstream registry will reference. The main takeaway is that most access problems come from mismatched names, groups or secrets, so confirm each mapping before the first image is pushed or pulled.

ObjectHarbor sideKubernetes or pipeline sideWhat to confirm
Image namespaceHarbor project, with repositories under itImage reference prefix in pod specs, such as the registry host and project nameProject names match the image paths in every manifest and Helm chart
Human accessProject role mapped from an OIDC or LDAP/AD groupDevelopers who push or pull through the Harbor UI, API or docker CLIGroup claims or LDAP group DNs are mapped to the right role per project
CI push rightsRobot account or dedicated service user with push permission on specific projectsCI runner secret holding the robot credentials, scoped to one pipelineRobot accounts are limited to the projects they need and their credentials rotate on a schedule you set
Cluster pull rightsRobot account or read-only user with pull permission on production projectsdocker-registry Secret in each namespace, referenced by imagePullSecretsEach namespace that runs images from Harbor has its own pull Secret and the pod spec or service account references it
Proxy cache projectProxy cache project pointing at an upstream such as Docker Hub, Quay or another registryImage references rewritten to the Harbor proxy path in manifests or mirror settingsUpstream credentials, read-only behavior and the default 7-day retention policy fit your image update process
Replication endpointRegistry endpoint of type Harbor, Docker registry, ECR, ACR, GCR, Artifact Registry, GHCR, Artifactory or othersTarget registry in a second site or cloud account that receives replicated artifactsEndpoint type is supported in your environment, and credentials and network routes to the target are tested
Air-gapped control plane imagesHarbor project holding kubeadm control plane images pushed in advancekubeadm init --image-repository pointing at that projectImage list from kubeadm config images list matches what is pulled and mirrored into the project

How images flow from upstream to cluster nodes through Harbor

The flow starts with CI pushing a built image into a Harbor project on the connected side, where Trivy scans it before anything else moves. A policy gate decides whether the image may be replicated across the boundary to the air-gapped Harbor, which is the step to check most carefully, since that is where the isolated site receives only artifacts someone has approved. On the isolated side, nodes pull through image pull secrets, and kubeadm is pointed at the same registry for control plane images. Confirm which projects replicate and which scan results are required before a copy is allowed to cross.

Image path from CI to cluster nodes, with the connected and isolated trust boundary marked.

Scanning images before they reach the cluster

Harbor scans images, but it does not stop a pod from running one. Harbor ships static vulnerability analysis built on the open-source Trivy scanner. Trivy is enabled at install time with the --with-trivy option, and Harbor can also connect to an external Trivy instance or to other scanners. Decide which scanner your organization will treat as authoritative, confirm the scanner version your Harbor release bundles (v2.15.4 bundles Trivy 0.75.0), and set scan-on-push for projects that feed production clusters. Scan results only protect you if something downstream reads them. Confirm how your cluster enforces them: an admission controller or policy engine that checks the scan report, a signature or attestation requirement, or a pipeline gate that blocks promotion. Without one of these, a vulnerable image that is pulled by tag will run without any warning from Harbor.

Plan the policy before the first scan. Define which severities block promotion, how exceptions are approved and recorded, and whether a finding that appears after deployment triggers a rebuild, a redeploy or only a ticket. Harbor's own project settings can prevent pulls of images that exceed a severity threshold, but you should test that behavior with a known-vulnerable test image in a non-production project before you rely on it. Also check the external scanner connection and the vulnerability database update path in an air-gapped site, because a scanner that cannot refresh its database will report stale results.

Two Harbor v2.15.3 changes affect this design. The release fixed a batch of security advisories and blocks webhooks to internal network addresses by default, so any scan-result or policy webhook that targets an in-cluster service needs an explicit review. The same release makes signing of unsigned images fail in projects that enforce content trust, so signing and scanning rules must be planned together and tested in each project before upgrading. Review the goharbor/harbor release notes for v2.15.3 and confirm both behaviors in your own environment before you change any project settings.

Hardening the registry and the cluster pull path

A private registry only helps if the path from Harbor to the kubelet is locked down at each step. The cards below cover the Harbor identities that push and pull images, the pull secrets that carry those credentials into clusters, the network and TLS boundary, and the upgrade routine that keeps Harbor patched without losing data.

Least-privilege robot accounts

Give each cluster or pipeline its own Harbor robot account with pull-only rights on the projects it needs, rather than a shared administrator login. Scope each robot to one project and one permission set, and set an expiry so that stale credentials stop working. Review robot accounts when a cluster is retired or a pipeline changes owner, because an orphaned robot account with pull rights still exposes every image in its project. Confirm the exact permission options in your Harbor version before you write the policy.

Pull secrets scoped per namespace

Create a docker-registry Secret in each namespace that needs Harbor images, and reference it from the workload's service account rather than the default one. A single pull secret copied across every namespace turns one leaked credential into access for the whole cluster. Keep the Secret's scope narrow and rotate the robot credential on a fixed schedule, updating the Secrets in each namespace as part of the same change.

Encryption at rest for pull secrets

Kubernetes stores Secrets unencrypted in etcd by default, and pull secrets are Secrets like any other. Enable encryption at rest for etcd, restrict list and watch access to Secrets with least-privilege RBAC, and check who can read Secrets through the API and etcd backups. Where the registry credentials must not sit in etcd at all, consider mounting them from an external store through the Secrets Store CSI Driver. Ask your platform team to confirm which of these controls already exists in your cluster.

Kubernetes Secrets good practices

TLS on Harbor endpoints

Serve Harbor only over HTLS with certificates issued by an authority that every node and build runner trusts, and distribute the CA to the container runtime on each node. Clients that skip verification or add insecure registry exceptions quietly bypass both integrity and identity checks on pulls. Decide where TLS terminates, whether at Harbor, an ingress or a load balancer, and make sure the internal hop from that point is also protected. Test a pull from a node that has no prior trust configuration.

Network paths to the registry

Restrict which networks can reach Harbor's API and registry endpoints, so that only cluster nodes, build runners and the replication peer can connect. Harbor's webhooks to internal addresses are blocked by default from v2.15.3, so any notification or integration that targets an internal host needs an explicit decision and a documented exception. Document every egress path from the cluster to Harbor, and confirm that nodes in air-gapped sites reach only their local registry.

Pod Security Standards on workloads

Enforce the Restricted Pod Security Standard on namespaces that run images pulled from Harbor, using the built-in Pod Security Admission controller. A trusted registry does not prevent a compromised or misconfigured image from running as root, mounting host paths or escalating privileges. Start with the warn and audit modes to find workloads that would break, then move to enforce. Record which namespaces use Baseline or Privileged and why.

Standard levels
3
Pod Security Standards

Patching Harbor from release notes

Track the Harbor GitHub releases and read the notes for every patch, since some releases fix security advisories and others change behavior. Take a backup before any upgrade, as the v2.15.2 release notes recommend, and plan a reindexdb run if index problems appear. Test the upgrade on a non-production instance first, and check breaking changes such as the content trust behavior in v2.15.3 against your projects. Ask your team to confirm how backups of the database and image storage are restored, not just taken.

Harbor release notes

Why image pulls and kubeadm bootstraps fail against a private registry

This table lists the failures teams most often hit when nodes pull images from Harbor or when kubeadm bootstraps from a private registry, with the likely cause and the fix for each. Read it before a cutover, and use it to check the registry path, trust chain and upgrade notes against your own environment.

FailureLikely causeFix
Nodes reject the Harbor TLS certificateThe internal CA is not in the node trust store, or the certificate does not cover the registry hostnameInstall the CA on every node and container runtime, then confirm the certificate names match the hostname used in image references
Pulls fail with unauthorized on private projectsNo image pull secret in the namespace, or the service account does not reference itCreate a docker-registry Secret per namespace and attach it to the service account or pod spec, using a robot account with pull-only rights
Image not found although it was pushedProject name or repository path in the image reference does not match what was pushedCompare the full path with the Harbor project and repository list, and check that the project is not private to a different group
Deployments blocked after a scanA project policy prevents pulls of images whose scan results exceed the configured severityReview the scan report, rebuild or patch the image, or adjust the policy with the security owner before retagging
Webhooks stop delivering after upgrade to v2.15.3Webhooks to internal network addresses are blocked by default in this releaseReview the webhook endpoints and confirm the destinations are approved, then allow them through the configuration Harbor documents for that setting
Signing fails in content trust projects after v2.15.3Signing unsigned images now fails in projects that enforce content trustSign images before push or move them through a signing pipeline, and test the change in a non-production project first
Harbor services fail after upgrading to v2.15.2The bundled database moves from PostgreSQL 15 to PostgreSQL 18 on startup, and Redis is replaced by ValkeyTake a backup before upgrading, follow the release notes, and run reindexdb if index problems appear
kubeadm pulls from the wrong registryThe --image-repository value does not match the mirrored image paths, or the mirrored tags differ from the kubeadm versionRun kubeadm config images list with the same flag used for init, mirror those exact tags into Harbor, and pass the same repository to init

Questions teams ask before running Harbor for Kubernetes

What drives the cost of running Harbor for Kubernetes?

The cost depends mostly on how many environments the registry serves, how many replicas and storage tiers it needs, and how much integration work sits around it. Harbor itself is licensed under Apache-2.0, so the spend is in people and infrastructure: the planning and installation work, the cloud or data center resources that host the registry and its storage, the scanning and replication design, and ongoing administration. Ask a partner to price these as separate line items so you can see which parts recur. Do not expect a licensing line for the software itself.

Which parts of a Harbor engagement are one-time and which recur?

One-time work covers requirements, architecture, installation with the chosen scanner, identity integration, project and access design, replication rules, image pull secret patterns and the cluster changes that point kubeadm at the registry. Recurring work covers patching Harbor, which the project ships regularly across its supported lines, reviewing scan results, monitoring storage and garbage collection, rotating credentials and testing backups. Harbor v2.15.2 also changed the bundled database and cache, so upgrades need their own planned window. Ask the quote to state which tasks are included and which are retainer items.

How long does a Harbor registry project take and who has to be involved?

Duration depends on the number of clusters, the identity provider you connect, whether you need high availability through the Helm chart, and how many replication targets exist. No duration is fixed here, so ask for a timeline built from your written scope. Expect involvement from platform engineering for the cluster and node changes, the identity team for LDAP, AD or OIDC single sign-on, the security team for scanning policy and exception handling, and storage or backup owners for the registry data. Your decision makers should approve the access model before installation starts.

What does the client need to provide before the work starts?

You need a defined set of clusters and the image sources they pull from, an identity provider with LDAP, AD or OIDC settings, storage with a backup approach, DNS and TLS certificates, and a host or cluster where Harbor will run. Confirm the Harbor version you will standardize on, since the documentation covers v2.15.0 and later patches change behavior. Also provide the list of approved upstream registries for proxy cache and any policy for signing. Missing inputs are the most common reason scope grows after the quote.

Can an internal team run Harbor for Kubernetes without outside help?

A capable platform team can install Harbor from the documentation, and kubeadm supports clusters without internet access through the image list, pull and image repository options. The harder parts are design decisions: project boundaries, role mapping, scanning gates, replication topology and upgrade testing. Teams often underestimate the operational load of garbage collection, certificate renewal and version upgrades. Decide whether your staff have time for these tasks over the life of the registry, and whether a retainer for upgrades and patch review is better aligned with your staffing.

How does air-gapped replication change the scope of a Harbor project?

Air-gapped sites add a transfer path, a second Harbor or compatible registry on the isolated side, and a verification step before anything enters the boundary. Harbor replication rules can run push or pull based, filter by repository, tag, label and resource type, and run on a schedule or on events, with optional bandwidth limits. The scope also grows because you must define how images, scan results and signatures cross the boundary, how each package is checked for integrity, and how the isolated site receives updates to Harbor itself. Request each replication path and its validation step as separate deliverables in the quote.

What should a written quote for Harbor for Kubernetes include?

Ask for a fixed scope statement listing the clusters, identity source, storage backend, scanning configuration and replication targets. Require deliverables for architecture, installation, access model, image pull secret pattern, kubeadm registry change, backup and restore test, and handover documentation. Request the assumptions behind effort, the client inputs that must arrive by a stated point, the upgrade approach for Harbor and its bundled components, and what is covered after handover. Ask which items are one-time and which are optional retainer services, and confirm how changes to scope are priced.

Does scanning before deployment need extra work beyond installation?

Yes. Harbor provides static analysis through the Trivy scanner when installed with the --with-trivy option, or it can connect to an external Trivy instance or other scanners. You still need to decide scan-on-push behavior, which severities block a pull, how exceptions are approved and who receives findings. Trivy's version is bundled with each Harbor release, so you should confirm the bundled version and the vulnerability database update path in an offline environment. Admission checks in the cluster must match the registry policy so that blocked images do not reach workloads.

How DeployOpen scopes, delivers and supports a Harbor registry

DeployOpen plans, implements, hardens, documents and supports self-hosted open-source platforms inside your own infrastructure, including Harbor as the in-house registry for cluster images. Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.

How we scope

  • Inventory the clusters, namespaces and image sources that will pull from the registry and who owns each.
  • Agree in writing which Harbor projects, roles, SSO settings, scanning policy and replication links are in scope.
  • Confirm the air-gapped sites, upstream registries and proxy cache sources, and who approves each image path.

How we build

  • Install and configure Harbor in your environment, with Trivy scanning enabled and access tied to your identity provider.
  • Set up replication rules and image pull secrets, then point kubeadm at the private registry and verify pulls.
  • Test access control, scan gating and replication behavior against the agreed scope before handover.

How we hand over

  • Deliver runbooks for projects, user access, scanning policy, replication, backups and Harbor upgrades.
  • Document the image intake process your teams follow when bringing new packages across an isolated boundary.
  • Walk your platform, security and compliance teams through the configuration and the evidence it produces.

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer after handover, if your team wants it.
  • Plan Harbor patch and minor upgrades with a backup beforehand, reviewing release notes for breaking changes.
  • Retest scanning, replication and access controls after upgrades or changes to the cluster or identity setup.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.