This document describes the subscription of Harbor Operator and the functionality based on Harbor instance deployment.
This document applies to Harbor 2.12 and above versions provided by the platform. It is decoupled from the platform based on technologies such as Operator.
Please ensure that Harbor Operator has been deployed (subscribed) in the target cluster, meaning the Harbor Operator is ready to create instances.
Harbor supports various resource configurations to accommodate different customer scenarios. In different scenarios, the required resources and configurations may vary significantly. Therefore, this section describes what aspects need to be considered in deployment planning before deploying Harbor instances, and what the impact of decision points is, to help users make subsequent specific instance deployments based on this information.
The Harbor Operator provided by the platform is based on the community's official Harbor Operator, with enterprise-level capability enhancements such as ARM support and security vulnerability fixes. It is fully compatible with the community version in terms of functionality, and in terms of experience, it enhances the convenience of Harbor deployment through optional and customizable templates.
A Harbor instance contains multiple components, such as the Registry component responsible for managing image files, the PostgreSQL component providing storage for application metadata and user information, and the Redis component for caching, etc. The platform provides professional PostgreSQL Operator and Redis Operator, so when deploying Harbor instances, Redis and PostgreSQL resources are no longer directly deployed, but accessed through configuring specific access credentials for existing instances.
Pre-deployment resource planning refers to decisions that need to be made before deployment and take effect during deployment. The main contents include:
High Availability
Harbor supports high availability deployment, with the following main impacts and limitations:
Each component will use multiple replicas
Network access no longer supports NodePort, but requires access through domain names configured via Ingress
Storage methods no longer support node storage, but require access through StorageClass or PVC
Resources
According to community recommendations and practices, a non-high-availability Harbor instance can run with a minimum of 2 cores and 4Gi of resources, while in high availability mode, a minimum of 8 cores and 16Gi of resources is required for stable operation.
Storage
| Component | Supported Storage Type | Description |
|---|---|---|
| Registry | object storage (e.g., MinIO) file storage (e.g., Ceph FS) | For scenarios with high pull image concurrency, it is recommended to use object storage and enable the redirect feature. The sequential read/write throughput of the storage disk (with a 1 MB block size) should not be lower than 100 MiB/s. |
| JobService | file storage (e.g., Ceph FS) | Job logs can also be stored in the database, in which case it is not necessary to configure storage for the job service. |
| Trivy | file storage (e.g., Ceph FS) | Stores the vulnerability database and cache; persistence is optional. Without persistence, it falls back to emptyDir, so restarts re-download the DB and temporarily halt scans. |
Common storage methods provided by the platform can be used for Harbor, such as storage classes, persistent volume claims, node storage, etc.
To intentionally skip persistence for Trivy, leave spec.helmValues.persistence.persistentVolumeClaim.trivy.storageClass unset. The vulnerability database then lives on an emptyDir volume, so each Trivy pod restart triggers a full database download and blocks vulnerability scans until it completes.
Node storage is not suitable for high availability mode, as it stores files in a specified path on the host node
Additionally, Harbor supports object storage. For configuration instructions, see Using Object Storage as the Registry Storage Backend.
Network
The platform provides two mainstream network access methods: NodePort and Ingress
NodePort requires specifying HTTP port and SSH port, and ensuring the ports are available. NodePort is not suitable for high availability mode
Ingress requires specifying a domain name and ensuring that the domain name resolution is normal
The platform supports HTTPS protocol, which needs to be configured after instance deployment. See Configure HTTPS for details.
Redis
It is recommended to use block storage (e.g., TopoLVM) to achieve higher IOPS and lower latency.
The current Redis component version that Harbor depends on is v6. It is recommended to use the Redis Operator provided by the platform to deploy Redis instances, and then complete Redis integration by configuring access credentials.
secret resource with specific format content. See Configure Redis, PostgreSQL, and Account Access Credentials for details.Known Issue: Modify Harbor Project Permissions Prompt Internal Server Error
PostgreSQL
It is recommended to use block storage (e.g., TopoLVM) to achieve higher IOPS and lower latency.
The current PostgreSQL component version that Harbor depends on is v14. It is recommended to use the PostgreSQL Operator provided by the platform to deploy PostgreSQL instances, and then complete PostgreSQL integration by configuring access credentials.
secret resource with specific format content. See Configure Redis, PostgreSQL, and Account Access Credentials for details.Account Credentials
When initializing a Harbor instance, you need to configure the admin account and its password. This is done by configuring a secret resource. See Configure Redis, PostgreSQL, and Account Access Credentials for details.
Post-deployment configuration planning refers to planning that does not require decisions before deployment, but can be changed as needed through standardized operations after deployment. This mainly includes Single Sign-On (SSO), HTTPS configuration, external load balancer configuration, etc. Please refer to Subsequent Operations for details.
The Harbor Operator provided by the platform mainly offers two deployment methods: deployment from templates and deployment from YAML.
The platform provides two built-in templates for use: the Harbor Quick Start template and the Harbor High Availability template, while also supporting custom templates to meet specific customer scenarios.
Information about the built-in templates and YAML deployment is as follows:
Harbor Quick Start TemplateThis template is used to quickly create a lightweight Harbor instance suitable for development and testing scenarios, not recommended for production environments.
Complete the deployment by filling in the relevant information according to the template prompts.
Harbor High Availability TemplateDeploying a high-availability Harbor instance requires higher resource configuration and provides a higher availability standard.
To achieve Harbor high availability, external dependencies must meet the following conditions:
Redis and PostgreSQL instances must be highly availableComplete the deployment by filling in the relevant information according to the template prompts.
Harbor Object Storage TemplateDeploy a Harbor instance based on object storage.
In this template the Trivy scanner does not persist data; it mounts an emptyDir, so every pod restart downloads the vulnerability database again and temporarily blocks new scans until the sync finishes.
Verify that the object storage credentials you supply meet the required S3 API permissions, see Object Storage Credentials.
Complete the deployment by filling in the relevant information according to the template prompts.
YAML deployment is the most basic and powerful deployment capability. Here we provide corresponding YAML snippets for each dimension from the Deployment Planning section, and then provide two complete YAML examples for complete scenarios to help users understand the YAML configuration method and make configuration changes as needed.
In high availability mode, Harbor component replicas should be at least 2. The YAML configuration snippet is as follows:
Harbor data storage mainly includes three parts:
Currently, three storage configuration methods are supported: storage class, PVC, and local node storage. When using storage class or pvc, the storage must support multi-node read and write (ReadWriteMany).
For Registry, Object Storage (S3) can also be used as the storage backend.
Jobservice supports storing job logs in multiple locations (file, database. stdout). If you haven't chosen to output the jobservice logs to file, there's no need to configure a storage backend for jobservice. See Configure Job Log Storage for details.
Storage class configuration snippet:
PVC configuration snippet (PVCs need to be created in advance):
Local node storage configuration snippet:
Configure Object Storage (S3) as the Registry storage backend:
Use Amazon S3 or S3 compatible services for object storage, such as MinIO, Ceph.
The Object Storage bucket must be created in advance.
The <object-storage-secret> secret must be created in advance.
| Field | Description | Example Value |
|---|---|---|
| object-storage-secret | Secret containing S3 access key and secret key, see Object Storage Credentials for details | object-storage-secret |
| bucket | Name of the object storage bucket, which must be created in advance | harbor-registry |
| regionendpoint | Endpoint URL of the object storage service (include port if needed) | http://192.168.133.37:32227 |
| region | Region of the object storage (typically us-east-1 for MinIO) | us-east-1 |
| disableredirect | Set to false to enable redirect and improve pull performance. Harbor will return temporary S3 URLs for layers, so clients must reach the S3 endpoint or layer downloads will fail) | true |
For more details, see S3 storage driver
If you want to use Ceph in platform, please refer to .
Harbor currently only supports configuring the Registry component to use S3 storage. Other components will continue to use PVC or StorageClass for persistent storage.
Network access mainly includes two methods: domain name access and NodePort access.
Domain name access configuration snippet:
NodePort access configuration snippet:
This refers to the configuration snippet for these credentials in the Harbor instance after configuring the Redis credentials secret resource:
Standalone example:
Sentinel example:
This refers to the configuration snippet for these credentials in the Harbor instance after configuring the PostgreSQL credentials secret resource:
This refers to the configuration snippet for these credentials in the Harbor instance after configuring the account credentials secret resource:
Configuring SSO involves the following steps:
Create the following OAuth2Client resource in the global cluster to register the SSO authentication client:
Edit the Harbor instance to add the following configuration:
After deploying the Harbor instance, HTTPS can be configured as needed.
First, create a TLS certificate secret in the namespace where the instance is located:
Then edit the Harbor instance's YAML configuration to enable HTTPS access:
Harbor's image scanning functionality is implemented by the Trivy component. Considering the user's network environment, the default vulnerability database policy for this component is to use the built-in offline vulnerability database. Since the vulnerability database is not updated, it cannot detect new vulnerabilities in a timely manner.
If you want to keep the vulnerability database up-to-date, you can edit the Harbor instance's YAML configuration to enable the online update policy (this policy requires access to GitHub):
After enabling the online update policy, Trivy will determine whether to update the vulnerability database before scanning based on the last update time. Since downloading the vulnerability database takes some time, if you don't need Java vulnerability scanning, you can also edit the Harbor instance's YAML configuration to disable Java vulnerability database updates:
Harbor supports deployment in IPv6 environments, but you need to ensure that your client tools' versions support IPv6. If you encounter an invalid reference format error, please check whether your client tool version supports IPv6.
Related community issues:
When deploying Harbor in a namespace with Pod Security Policy (PSP) configured, the deployment support is as follows:
privileged or baseline.privileged.