Preparing to Create a Service

This topic explains how to create private registry credentials to prepare for creating a service. If you are using a private registry, you must add the same credentials you used for your private registry to the service account you used to create Knative services.

Note: You must complete following steps for each namespace where you create services.

  1. Create a secret for your private registry credentials. Run:

    kubectl -n "${WORKLOAD_NS}" create secret docker-registry registry-credentials \
    --docker-server "$cnr_registry__server" \
    --docker-username "$cnr_registry__username" \
    --docker-password "$cnr_registry__password"


    • WORKLOAD_NS is the namespace where you want to create services.
    • $cnr_registry__server, $cnr_registry__username, and $cnr_registry__password environment variables have the same values you used to install Cloud Native Runtimes with a private registry. See Prerequisites in the Use Image Relocation with Cloud Native Runtimes section.
  2. Add the secret to your namespace’s default service account.

    kubectl patch serviceaccount -n ${WORKLOAD_NS} default -p '{"imagePullSecrets": [{"name": "registry-credentials"}]}'
check-circle-line exclamation-circle-line close-line
Scroll to top icon