Quick Start
This document will help you quickly understand how to create an OCI Connector and use it for securely accessing container registries without directly handling credentials.
TOC
Introduction
Applicable Scenarios
The OCI (Open Container Initiative) Connector provides a secure way to:
- Access container registries (Docker Hub, Harbor, etc.) without embedding credentials in workloads
- Centrally manage registry authentication information
- Use a proxy mechanism to securely push and pull container images
- Configure container tools to work with the registry proxy
This approach is particularly useful for:
- CI/CD pipelines that need to push images to private registries
- Multi-team environments where registry credentials need to be shared securely
- Container build processes within Kubernetes
Estimated Reading Time
15 minutes
Notes
- The OCI connector uses CSI driver integration to inject registry credentials securely.
- Different container tools (Docker, Buildah, etc.) may require specific configuration for insecure registry access.
- Configuration files generated by the connector expire after 30 minutes.
Prerequisites
- Kubernetes cluster with Connectors system installed (Operator, Core, and OCI components). See the Installation Guide for details on installing these components.
- kubectl configured to communicate with your cluster
- Access credentials for a container registry (Docker Hub, Harbor, etc.)
- Basic knowledge of Kubernetes resources
Process Overview
Steps to Operate
Step 1: Create Namespace
Create a dedicated namespace for this demonstration:
Step 2: Create Registry Credentials and OCI Connector
Create both the Secret containing registry credentials and the OCI Connector resource. For more detailed information about creating and configuring connectors, please refer to the Connectors Quick Start Guide.
Verify that the connector is in "Ready" status:
The output should show:
Step 3: Create a Container Build/Push Job
Create a ConfigMap with a sample Dockerfile:
Create a job that uses the connector to build and push a container image:
Key parameters in the volume definition:
connector.name: The name of your OCI connectorconfiguration.names: Specifies which configuration to generate from the OCI ConnectorClass:"docker-config": Generates authentication config (config.json) needed for any registry operations"buildkitd": Generates BuildKit daemon config for insecure registry access
mountPath: Specifies where the configuration file should be mounted in the container:- "/root/.docker" for Docker authentication configuration
- "/etc/buildkit" for BuildKit 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.
Expected Results
After successfully completing all steps, you will see:
-
An OCI connector in "Ready" status:
-
A successful image build and push operation in the job logs, showing that the image was pushed to the registry via the connector proxy.
-
The connector's proxy address in the status field:
How It Works
The OCI Connector works by:
- Creating a proxy service that sits between your workloads and the container registry
- Injecting authentication information when requests pass through the proxy
- Providing configuration files for container tools to work with the proxy
The connector generates three types of configuration files that serve different purposes:
-
docker-config: Creates a
config.jsonfile with the necessary authentication information to access the proxy serviceThis configuration is essential for authentication and is required for all container operations.
-
buildkitd: Creates a
buildkitd.tomlfile that configures BuildKit to trust the insecure registry proxyThis is only needed when using BuildKit to build and push images.
To examine the generated configuration:
View the generated configuration:
Troubleshooting
If your container operation fails, check the following:
-
Connector Status: Ensure the connector is in "Ready" state:
-
RBAC Permissions: Verify the RoleBinding is correctly configured.
-
Registry Access: Confirm that the credentials have access to the specified repository.
-
Configuration Mounting: Ensure the configuration volumes are correctly mounted in the job.
-
Proxy Address: Make sure you're using the correct proxy address from
status.proxy.httpAddress.urlin your image references.
Next Steps
After successfully pushing your first image using the OCI Connector, you can:
- Use the connector in Kubernetes workloads to pull private images
- Integrate with CI/CD pipelines to build and push images
- Configure different container tools to work with the connector
- Use the connector with different registry services