Bitnami提供的Helm chart,用于简化企业级Docker镜像仓库Harbor在Kubernetes环境中的部署和管理。
Bitnami Secure Images Helm chart for Harbor
Harbor is an open source trusted cloud-native registry to store, sign, and scan content. It adds functionalities like security, identity, and management to the open source Docker distribution.
Overview of Harbor
TL;DR
consolehelm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/harbor
Note: You need to substitute the placeholders
REGISTRY_NAMEandREPOSITORY_NAMEwith a reference to your Helm chart registry and repository.
Introduction
This https://github.com/kubernetes/helm chart installs https://github.com/goharbor/harbor in a Kubernetes cluster.
This Helm chart has been developed based on https://github.com/goharbor/harbor-helm chart but includes some features common to the Bitnami chart library. For example, the following changes have been introduced:
- You can pull all required images from a private registry using the global Docker image parameters.
- Redis® and PostgreSQL are managed as chart dependencies.
- Liveness and Readiness probes for all deployments are exposed to the values.yaml.
- Uses new Helm chart label formatting.
- Uses Bitnami non-root container images by default.
- This chart supports the Harbor optional components.
Before you begin
- Kubernetes 1.23+
- Helm 3.8.0+
- PV provisioner support in the underlying infrastructure
Installing the chart
To install the chart with the release name my-release:
consolehelm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/harbor
Note You need to substitute the placeholders
REGISTRY_NAMEandREPOSITORY_NAMEwith a reference to your Helm chart registry and repository. For example, in the case of Bitnami, you need to useREGISTRY_NAME=registry-1.docker.ioandREPOSITORY_NAME=bitnamicharts.
Configuration and installation details
This section covers resource requests, exposure, TLS, backup, and other options.
Resource requests and limits
Bitnami charts allow setting resource requests and limits for all containers inside the chart deployment. These are inside the resources value (check parameter table). Setting requests is essential for production workloads and these should be adapted to your specific use case.
To make this process easier, the chart contains the resourcesPreset values, which automatically sets the resources section according to different presets. Check these presets in https://github.com/bitnami/charts/blob/main/bitnami/common/templates/_resources.tpl#L15. However, in production workloads using resourcesPreset is discouraged as it may not fully adapt to your specific needs. Find more information on container resource management in the https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/.
https://techdocs.broadcom.com/us/en/vmware-tanzu/bitnami-secure-images/bitnami-secure-images/services/bsi-doc/apps-tutorials-understand-rolling-tags-containers-index.html
It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image.
Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist.
Prometheus metrics
This chart can be integrated with Prometheus by setting metrics.enabled to true. This will expose the Harbor native Prometheus port in both the containers and services. The services will also have the necessary annotations to be automatically scraped by Prometheus.
Prometheus requirements
It is necessary to have a working installation of Prometheus or Prometheus Operator for the integration to work. Install the https://github.com/bitnami/charts/tree/main/bitnami/prometheus or the https://github.com/bitnami/charts/tree/main/bitnami/kube-prometheus to easily have a working Prometheus in your cluster.
Integration with Prometheus Operator
The chart can deploy ServiceMonitor objects for integration with Prometheus Operator installations. To do so, set the value metrics.serviceMonitor.enabled=true. Ensure that the Prometheus Operator CustomResourceDefinitions are installed in the cluster or it will fail with the following error:
textno matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
Install the https://github.com/bitnami/charts/tree/main/bitnami/kube-prometheus for having the necessary CRDs and the Prometheus Operator.
Configure how to expose Harbor core
You can expose Harbor core using three methods:
- Gateway API
HTTPRoute,exposureTypeshould be set tohttproute.- A Gateway controller must be installed in the Kubernetes cluster.
- An Ingress Controller,
exposureTypeshould be set toingress.- An ingress controller must be installed in the Kubernetes cluster.
- If the TLS is disabled, the port must be included in the command when pulling/pushing images. See issue https://github.com/goharbor/harbor/issues/5291 for the detail.
- An NGINX Proxy,
exposureTypeshould be set toproxy. There are three ways to do so depending on the NGINX Proxy service type:- ClusterIP: Exposes the service on a cluster-internal IP. Choosing this value makes the service only reachable from within the cluster:
- NodePort: Exposes the service on each Node's IP at a static port (the NodePort). You'll be able to contact the NodePort service, from outside the cluster, by requesting
NodeIP:NodePort. - Load***: Exposes the service externally using a cloud provider's load ***.
Configure the external URL
The external URL for Harbor core service is used to:
- populate the docker/helm commands showed on portal
Format: protocol://domain[:port]. Usually:
- If you expose Harbor core service using Gateway API
HTTPRoute, thedomainshould be the value ofhttpRoute.hostnames[0]. - If you expose Harbor core service using Ingress, the
domainshould be the value ofingress.hostname. - If you expose Harbor core using NGINX proxy with a
ClusterIPservice type, thedomainshould be the value ofservice.clusterIP. - If you expose Harbor core using NGINX proxy with a
NodePortservice type, thedomainshould be the IP address of one Kubernetes node. - If you expose Harbor core using NGINX proxy with a
LoadBalancerservice type, set thedomainas your own domain name and add a CNAME record to map the domain name to the one you got from the cloud provider.
If Harbor is deployed behind the proxy, set it as the URL of proxy.
Update database schema
In order to update the database schema, the helm chart deploys a special Job that performs the migration. Enable this by setting the migration.enabled=true value.
This Job relies on helm hooks, so any upgrade operation will wait for this Job to succeed.
Securing traffic using TLS
It is possible to configure TLS communication in the core, jobservice, portal, registry and trivy components by setting internalTLS.enabled=true. The chart allows two configuration options:
- Provide your own secrets for Harbor components using the
*.tls.existingSecret(under thecore,jobservice,portal,registryand `trivy' sections) values. - Have the chart auto-generate the certificates. This is done when not setting the
*.tls.existingSecretvalues.
Additionally, it is possible to add a custom authority to each component trust store. This is done using the internalTLS.caBundleSecret value with the name of a secret containing the corresponding ca.crt file.
Backup and restore
To back up and restore Helm chart deployments on Kubernetes, you need to back up the persistent volumes from the source deployment and attach them to a new deployment using https://velero.io/, a Kubernetes backup/restore tool. Find the instructions for using Velero in https://techdocs.broadcom.com/us/en/vmware-tanzu/bitnami-secure-images/bitnami-secure-images/services/bsi-doc/apps-tutorials-backup-restore-deployments-velero-index.html.
Sidecars and Init Containers
If you have a need for additional containers to run within the same pod as any of the Harbor components (e.g. an additional metrics or logging exporter), you can do so using the sidecars config parameter inside each component subsection. Simply define your container according to the Kubernetes container spec.
CODE_TOKEN_3
Similarly, you can add extra init containers using the initContainers parameter.
CODE_TOKEN_4
Adding extra environment variables
In case you want to add extra environment variables (useful for advanced operations like custom init scripts), you can use the extraEnvVars property inside each component subsection.
CODE_TOKEN_5
Alternatively, you can use a ConfigMap or a Secret with the environment variables. To do so, use the extraEnvVarsCM or the extraEnvVarsSecret values inside each component subsection.
Configure data persistence
- Disable: The data does not survive the termination of a pod.
- Persistent Volume Claim(default): A default
StorageClassis needed in the Kubernetes cluster to dynamically provision the volumes. Specify another StorageClass in thestorageClassor setexistingClaimif you have already existing persistent volumes to use. - External Storage(only for images and charts): For images and charts, the supported external storage are:
azure,gcs,s3swiftandoss.
Configure the secrets
- Secrets: Secrets are used for encryption and to secure communication between components. Fill
core.secret,jobservice.secretandregistry.secretto configure them statically using the Helm values. it expects the "key or password", not the secret name where secrets are stored. - Certificates: Used for token encryption/decryption. Fill
core.secretNameto configure.
Secrets and certificates must be setup to avoid changes on every Helm upgrade (see: https://github.com/goharbor/harbor-helm/issues/107).
If you want to manage full Secret objects by your own, you can use existingSecret & existingEnvVarsSecret parameters. This could be useful for some secure GitOps workflows, of course, you will have to ensure to define all expected keys for those secrets.
The core service have two Secret objects, the default one for data & communication which is very important as it's contains the data encryption key of your harbor instance ! and a second one which contains standard passwords, database access password, ...
Keep in mind that the HARBOR_ADMIN_PASSWORD is only used to bootstrap your harbor instance, if you update it after the deployment, the password is updated in database, but the secret will remain the initial one.
Set pod affinity
This chart allows you to set your custom affinity using the XXX.affinity parameter(s). Find more information about pod affinity in the https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity.
As an alternative, you can use of the preset configurations for pod affinity, pod anti-affinity, and node affinity available at the https://github.com/bitnami/charts/tree/main/bitnami/common#affinities chart. To do so, set the XXX.podAffinityPreset, XXX.podAntiAffinityPreset, or XXX.nodeAffinityPreset parameters.
Adjust permissions of persistent volume mountpoint
As the images run as non-root by default, it is necessary to adjust the ownership of the persistent volumes so that the containers can write data into it.
By default, the chart is configured to use Kubernetes Security Context to automatically change the ownership of the volume. However, this feature does not work in all Kubernetes distributions.
As an alternative, this chart supports using an initContainer to change the ownership of the volume before mounting it in the final destination.
You can enable this initContainer by setting volumePermissions.enabled to true.
FIPS parameters
The FIPS parameters only have effect if you are using images from the https://go-vmware.broadcom.com/contact-us.
For more information on this new support, please refer to the https://techdocs.broadcom.com/us/en/vmware-tanzu/bitnami-secure-images/bitnami-secure-images/services/bsi-doc/security-frameworks-FIPS-compliance.html.
Parameters
The following subsections list global, common, and component-specific parameters.
Global parameters
| Name | Description | Value |
|---|---|---|
global.imageRegistry | Global Docker image registry | "" |
global.imagePullSecrets | Global Docker registry secret names as an array | [] |
global.defaultStorageClass | Global default StorageClass for Persistent Volume(s) | "" |
global.defaultFips | Default value for the FIPS configuration (allowed values: '', restricted, relaxed, off). Can be overridden by the 'fips' object | restricted |
global.security.allowInsecureImages | Allows skipping image verification | false |
global.compatibility.openshift.adaptSecurityContext | Adapt the securityContext sections of the deployment to make them compatible with Openshift restricted-v2 SCC: remove runAsUser, runAsGroup and fsGroup and let the platform use their allowed default IDs. Possible values: auto (apply if the detected running cluster is Openshift), force (perform the adaptation always), disabled (do not perform adaptation) | auto |
Common Parameters
| Name | Description | Value |
|---|---|---|
nameOverride | String to partially override common.names.fullname template (will maintain the release name) | "" |
fullnameOverride | String to fully override common.names.fullname template with a string | "" |
apiVersions | Override Kubernetes API versions reported by .Capabilities | [] |
kubeVersion | Override Kubernetes version reported by .Capabilities | "" |
clusterDomain | Kubernetes Cluster Domain | cluster.local |
commonAnnotations | Annotations to add to all deployed objects | {} |
commonLabels | Labels to add to all deployed objects | {} |
extraDeploy | Array of extra objects to deploy with the release (evaluated as a template). | [] |
diagnosticMode.enabled | Enable diagnostic mode (all probes will be disabled and the command will be overridden) | false |
diagnosticMode.command | Command to override all containers in the chart release | ["sleep"] |
diagnosticMode.args | Args to override all containers in the chart release | ["infinity"] |
Harbor common parameters
| Name | Description | Value |
|---|---|---|
adminPassword | The initial password of Harbor admin. Change it from portal after launching Harbor | "" |
existingSecret | Name of existing Secret containing the Harbor admin password | "" |
existingSecretAdminPasswordKey | Name of the key inside the existing secret containing the Harbor admin password (HARBOR_ADMIN_PASSWORD as default if not provided) | "" |
externalURL | The external URL for Harbor Core service | [***]"" |
proxy.httpsProxy | The URL of the HTTPS proxy server | "" |
proxy.noProxy | The URLs that the proxy settings not apply to | 127.0.0.1,localhost,.local,.internal |
proxy.components | The component list that the proxy settings apply to | ["core","jobservice","trivy"] |
logLevel | The log level used for Harbor services. Allowed values are [ fatal | error | warn | info | debug | trace ] | debug |
internalTLS.enabled | Use TLS in all the supported containers: core, jobservice, portal, registry and trivy | false |
internalTLS.caBundleSecret | Name of an existing secret with a custom CA that will be injected into the trust store for core, jobservice, registry, trivy components | "" |
ipFamily.ipv6.enabled | Enable listening on IPv6 ([::]) for NGINX-based components (NGINX,portal) | true |
ipFamily.ipv4.enabled | Enable listening on IPv4 for NGINX-based components (NGINX,portal) | true |
cache.enabled | Enable caching manifests in Redis for better performance on high concurrent pulling | false |
cache.expireHours | The time (in hours) to keep the cache | 24 |
database.maxIdleConns | The maximum number of connections in the idle connection pool per component | 100 |
database.maxOpenConns | The maximum number of open connections to the database per component | 900 |
Traffic Exposure Parameters
| Name | Description | Value |
|---|---|---|
exposureType | The way to expose Harbor. Allowed values are [ ingress | proxy | none ] | proxy |
service.type | NGINX proxy service type | Load*** |
service.ports.http | NGINX proxy service HTTP port | 80 |
| `service.ports.https |
Note: the README for this chart is longer than the DockerHub length limit of 25000, so it has been trimmed. The full README can be found at https://techdocs.broadcom.com/us/en/vmware-tanzu/bitnami-secure-images/bitnami-secure-images/services/bsi-app-doc/apps-charts-harbor-index.html
bitnamicharts 命名空间的其他可用镜像:
bitnamicharts/mysql
bitnamicharts/kafka
bitnamicharts/etcd
bitnamicharts/postgresql
bitnamicharts/milvus
bitnamicharts/cadvisor
镜像拉取方式
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
轩辕镜像加速拉取命令点我查看更多 harbor 镜像标签
DockerHub 原生拉取命令
用户好评
来自真实用户的反馈,见证轩辕镜像的优质服务