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
Common storage methods provided by the platform can be used for Harbor, such as storage classes, persistent volume claims, node storage, etc.
Node storage is not suitable for high availability
mode, as it stores files in a specified path on the host node
In addition, Harbor also supports object storage. In this mode, separate storage access method adaptation is required. Please consult the vendor for details.
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
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
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.
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 two 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)
Storage class configuration snippet:
PVC configuration snippet (PVCs need to be created in advance):
Local node storage configuration snippet:
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
.