Harbor Helm Chart

repository·main·Indexed 23 days ago

https://github.com/goharbor/harbor-helm

Official 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.

Tokens
13K
Snippets
9
Records
78
Agent score
80%

What's inside harbor-helm

  1. Install Harbor via Helm

    main

    Install the Harbor chart using a specific release name. If you have modified the values.yaml file, ensure you point to it or use --set flags.

    helm install my-release .
  2. Install the Harbor Helm chart

    main

    To 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 --set flag or by providing a custom values.yaml file.

    Prerequisites

    • Kubernetes cluster 1.20+
    • Helm v3.2.0+

    Steps

    1. Add the Helm repository:
      helm repo add harbor https://helm.goharbor.io
    2. Install the chart (using my-release as an example):
      helm install my-release harbor/harbor
    helm repo add harbor https://helm.goharbor.io
    helm install my-release harbor/harbor
  3. Preserve existing TLS certificates during upgrade

    main

    If 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:

    1. Identify the secret: Find the secret used for ingress or service exposure. Look for a secret ending in -ingress (for Ingress) or -harbor-nginx (for ClusterIP or NodePort) using kubectl get secret.
    2. Export the secret: Save the secret to a YAML file:
      kubectl get secret <secret-name> -o yaml > secret.yaml
    3. Prepare the secret: Edit secret.yaml to change the metadata.name to a new name.
    4. Recreate the secret: Apply the modified secret to the cluster:
      kubectl create -f secret.yaml
    5. Configure the chart: Update your Helm configuration to use this specific secret by setting:
      • expose.tls.certSource to secret
      • expose.tls.secret.secretName to the new name you defined in step 3.
    kubectl get secret <secret-name-from-step-1> -o yaml > secret.yaml
  4. Prerequisites for Harbor High Availability

    main

    To 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.
  5. Download the Harbor Helm Chart

    main

    Add the Harbor Helm repository and download the chart locally using the --untar flag to extract the files for inspection or manual configuration.

    helm repo add harbor https://helm.goharbor.io
    helm fetch harbor/harbor --untar
  6. Configure the Harbor Helm chart

    main
    The Harbor Helm chart is configured using a values.yaml file or via --set flags during the helm install or helm upgrade commands. 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).
  7. Upgrade Harbor deployed via Helm

    main

    To upgrade a Harbor installation deployed using this Helm chart (version 0.3.0 or later), follow these steps:

    1. Backup the database: Since database schema migrations occur during the upgrade, downtime is unavoidable. Always back up your database before proceeding.
    2. Download the new chart: Obtain the latest version of the Harbor chart.
    3. Configure the new chart: Ensure your values.yaml or configuration flags match your existing installation to prevent configuration drift.
    4. Execute the upgrade: Run the Helm upgrade command.

    Important Constraints:

    • No Automatic Downgrades: Because database schemas change, helm rollback is not supported. You cannot automatically downgrade the database schema.
    • Force Flag: If you are upgrading from version 0.3.0, you must use the --force flag.
    helm upgrade release-name --force .
  8. Configure internal Redis settings

    main

    If 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: []).
  9. Configure Harbor Portal settings

    main

    Use 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.