Quick Start
This document will help you quickly understand how to create a Harbor connector to connect to a Harbor registry and perform container image operations securely without directly handling credentials.
We will create a Harbor connector, and use it to perform container image operations without directly handling credentials in client side.
TOC
Estimated Reading TimePrerequisitesProcess OverviewSteps to OperateStep 1: Create NamespaceStep 2: Create Harbor Registry Credentials and ConnectorStep 3: Create a Job for Executing Container OperationsStep 4: Verify OperationHow It WorksEstimated Reading Time
15 minutes
Prerequisites
- Kubernetes cluster with Connectors system installed (Operator, ConnectorsCore and ConnectorsHarbor components). See the Installation Guide for details on installing these components.
- Harbor registry address and credentials
- Basic knowledge of Kubernetes and container registries
- The Harbor registry should be accessible and support standard container registry APIs
Process Overview
Steps to Operate
Step 1: Create Namespace
Create a dedicated namespace for this demonstration:
Step 2: Create Harbor Registry Credentials and Connector
Create both the Secret containing Harbor registry credentials and the Harbor connector resource.
For more detailed information about creating and configuring connectors, please refer to the Connectors Quick Start Guide.
Verify that the connector is ready:
Step 3: Create a Job for Executing Container Operations
Create a ConfigMap with a sample Dockerfile:
Create a Job that uses the connector to build and push a container image:
Verify that the job is running:
Key parameters in the volume definition:
connector.name: The name of your OCI connectorconfiguration.names: Specifies which configuration to generate from the OCI ConnectorClass:"config": Generates authentication config (config.json) needed for any registry operations"buildkitd": Generates BuildKit daemon config for insecure registry access- if not specified, will be mounted default configurations
mountPath: Specifies where the configuration file should be mounted in the container:- "/root/.docker" for buildkit authentication configuration
Step 4: Verify Operation
Check the job's logs to confirm the image was built and pushed successfully:
You should see the build process completing and the image being pushed to the registry.
How It Works
The Harbor Connector works by:
- Creating a proxy service that handles authentication with the Harbor registry
- Mounting proxy configuration into the Pod via the CSI driver
- Using the proxy configuration through environment variables during container image operations
- The proxy service validates the proxy configuration and injects Harbor registry authentication credentials
This allows workloads to access the Harbor registry without directly handling credentials.