Harbor Helm Chart
repository·main·Indexed 23 days ago
https://github.com/goharbor/harbor-helmOfficial Helm chart for deploying Harbor, a CNCF graduated cloud-native registry, into a Kubernetes cluster (v1.20+). Includes documentation for installation, uninstallation, and configuration of service exposure (Ingress, ClusterIP, NodePort, LoadBalancer, and Gateway APIs), data persistence via PVCs or external storage (S3, GCS, Azure, Swift, OSS), and internal TLS security for Harbor components.
What's inside harbor-helm
- This project provides a Helm chart to deploy and manage Harbor. For general Harbor documentation, including core features and usage, refer to the official Harbor docs. Use this repository specifically for Helm-based installation and lifecycle management on Kubernetes.
Install Harbor via Helm
mainInstall the Harbor chart using a specific release name. If you have modified the
values.yamlfile, ensure you point to it or use--setflags.helm install my-release .Install the Harbor Helm chart
mainTo install Harbor using Helm, first add the official Harbor repository, then install the chart using a release name. You can customize the installation using the
--setflag or by providing a customvalues.yamlfile.Prerequisites
- Kubernetes cluster 1.20+
- Helm v3.2.0+
Steps
- Add the Helm repository:
helm repo add harbor https://helm.goharbor.io - Install the chart (using
my-releaseas an example):helm install my-release harbor/harbor
helm repo add harbor https://helm.goharbor.io helm install my-release harbor/harborPreserve existing TLS certificates during upgrade
mainIf TLS is enabled and certificates were automatically generated by the chart, the upgrade process will overwrite them with new certificates. If you have distributed the old certificates to clients, this may cause connection issues.
To prevent this, manually migrate the existing secret to the new installation by following these steps:
- Identify the secret: Find the secret used for ingress or service exposure. Look for a secret ending in
-ingress(forIngress) or-harbor-nginx(forClusterIPorNodePort) usingkubectl get secret. - Export the secret: Save the secret to a YAML file:
kubectl get secret <secret-name> -o yaml > secret.yaml - Prepare the secret: Edit
secret.yamlto change themetadata.nameto a new name. - Recreate the secret: Apply the modified secret to the cluster:
kubectl create -f secret.yaml - Configure the chart: Update your Helm configuration to use this specific secret by setting:
expose.tls.certSourcetosecretexpose.tls.secret.secretNameto the new name you defined in step 3.
kubectl get secret <secret-name-from-step-1> -o yaml > secret.yaml- Identify the secret: Find the secret used for ingress or service exposure. Look for a secret ending in
Prerequisites for Harbor High Availability
mainTo deploy a highly available Harbor instance on Kubernetes, ensure the following requirements are met:
- Kubernetes: Version 1.20 or higher.
- Helm: Version v3.2.0 or higher.
- Ingress: A highly available ingress controller (Harbor does not manage the external endpoint).
- Database: A highly available PostgreSQL database (Harbor does not manage the HA deployment of the database).
- Cache: A highly available Redis instance (Harbor does not manage the HA deployment of Redis).
- Storage: Either a Persistent Volume Claim (PVC) that can be shared across nodes (
ReadWriteMany) or external object storage.
Download the Harbor Helm Chart
mainAdd the Harbor Helm repository and download the chart locally using the
--untarflag to extract the files for inspection or manual configuration.helm repo add harbor https://helm.goharbor.io helm fetch harbor/harbor --untarUninstall the Harbor Helm deployment
mainTo remove the Harbor deployment, use the
helm uninstallcommand followed by the name of your release.helm uninstall my-releaseConfigure the Harbor Helm chart
mainThe Harbor Helm chart is configured using avalues.yamlfile or via--setflags during thehelm installorhelm upgradecommands. The specific parameters available for customization are documented in the configuration table within the chart's documentation. You can override default values to tailor the Harbor deployment to your environment's requirements (e.g., storage, ingress, or resource limits).Upgrade Harbor deployed via Helm
mainTo upgrade a Harbor installation deployed using this Helm chart (version 0.3.0 or later), follow these steps:
- Backup the database: Since database schema migrations occur during the upgrade, downtime is unavoidable. Always back up your database before proceeding.
- Download the new chart: Obtain the latest version of the Harbor chart.
- Configure the new chart: Ensure your
values.yamlor configuration flags match your existing installation to prevent configuration drift. - Execute the upgrade: Run the Helm upgrade command.
Important Constraints:
- No Automatic Downgrades: Because database schemas change,
helm rollbackis not supported. You cannot automatically downgrade the database schema. - Force Flag: If you are upgrading from version 0.3.0, you must use the
--forceflag.
helm upgrade release-name --force .Scale Harbor Components for High Availability
mainTo ensure components are distributed across multiple worker nodes, increase the replica count for the following components to
n(wheren >= 2) invalues.yaml:portal.replicascore.replicasjobservice.replicasregistry.replicas
Configure internal Redis settings
mainIf using the internal Redis deployment, you can configure database indices for specific Harbor logic and define init containers.
Available keys:
redis.internal.harborDatabaseIndex: Database index for harbor miscellaneous business logic (default:0).redis.internal.cacheLayerDatabaseIndex: Database index for harbor cache layer (default:0).redis.internal.initContainers: List of init containers to run before the Redis container starts (default:[]).
Configure Harbor Portal settings
mainUse the following configuration keys to customize the Harbor Portal component:
portal.podAnnotations: Annotations to add to the portal pod.portal.serviceAnnotations: Annotations to add to the portal service.portal.priorityClassName: The priority class to run the pod as.portal.initContainers: List of init containers to be run before the controller's container starts.