Connect a registry
Connect Hub to a private registry, such as an Artifactory instance or an air-gapped mirror, so Catalog can pull and index the packages your control planes install from it. You can also have Hub scan a repository for new tags, so packages appear in the catalog before any control plane installs them.
Connecting registries is an alpha feature. Its API may change in incompatible ways between releases. See the feature lifecycle. It's off by default. Turn it on with the Registry feature flag.
Before you begin
- A
hubkubectl context. See Configure kubectl for the Hub. - Permission to create connections in the realm, which the realm admin and realm editor roles grant. See the Roles reference.
- Credentials for the registry that can pull its package images.
- To scan repositories, your platform team also turns on the
RegistryScanfeature flag.
How Hub chooses credentials
A connection tells Hub how to sign in to a registry: its host, an optional path scope, and credentials. Connections belong to a realm, and Hub only uses a realm's connections to pull images for control planes in that realm.
When Hub pulls an image, it picks the connection in the realm that matches the image most closely:
- A connection whose scope is exactly the image's repository.
- The connection with the longest scope that the repository starts with.
- A connection for the image's registry host.
A realm can have several connections for the same host, each scoped to a different path. Anonymous connections are never picked this way.
A repository tells Hub about one repository in a registry, so it can scan it for tags. A repository can name the connection to use, which skips the matching above.
Create a connection
-
Create the connection in the realm. Set
authMethodtoStaticand give a username and password, or toAnonymousfor a registry that needs no credentials:kubectl --context=hub create -f - <<'EOF'apiVersion: catalog.hub.upbound.io/v1alpha1kind: Connectionmetadata:name: platform-registrynamespace: defaultspec:displayName: Platform registryhost: registry.example.comscope: registry.example.com/platformauthMethod: Staticstatic:username: catalog-readerpassword: <token>EOFnamespaceis the realm.scopedefaults to the host. Hub stores the credentials and returns them as***when you read the connection. -
Check that Hub can reach the registry and sign in. Send a verification to the connection's
verifysubresource, with an image from the registry to test pulling:kubectl --context=hub create --raw \/apis/catalog.hub.upbound.io/v1alpha1/namespaces/default/connections/platform-registry/verify \-f - <<'EOF' | jq '.status'{"spec": {"testImage": "registry.example.com/platform/provider-example:v1.0.0"}}EOF{"reachable": true,"authenticated": true,"authorized": { "testImage": "registry.example.com/platform/provider-example:v1.0.0", "result": "ok" }}Hub saves the result on the connection, and the Console shows it on the connection's badge.
Scan a repository for new tags
Create a repository with the connection to use and how often to scan:
kubectl --context=hub create -f - <<'EOF'
apiVersion: catalog.hub.upbound.io/v1alpha1
kind: Repository
metadata:
name: provider-example
namespace: default
spec:
repository: registry.example.com/platform/provider-example
connectionRef:
name: platform-registry
scan:
interval: 1h
EOF
By default, a scan skips signature, attestation, and SBOM tags, and
pre-release versions. Set scan.exclusionList to your own list of patterns to
change that. You can't change connectionRef after you create the repository.
Hub also creates repositories for every repository it sees installed on a
control plane, with scanning suspended. Set scan.suspend: false on one to
start scanning it.
Troubleshoot
| Symptom | Cause |
|---|---|
404 on connections or repositories | Your platform team hasn't turned on the Registry feature flag. |
422 when you create a Static connection | spec.static needs at least one of username, password, auth, identityToken, or registryToken. An Anonymous connection must not set spec.static. |
409 when you create a connection | Another connection for the same host in the realm sets insecure differently, or the name is taken. |
400 from verify | The test image isn't on the connection's registry host. |
reachable is false | Hub can't reach the registry host from its network. |
authenticated is false | The registry rejected the credentials. |
authorized.result is forbidden | The credentials sign in, but can't pull the test image. Grant them read access to the repository. |
| A repository never scans | Your platform team hasn't turned on the RegistryScan feature flag, or the repository's scan.suspend is true. |
| Enrichment fails for an image from the registry | No connection in the control plane's realm matches the image. Check the connection's scope. |