1. Check If Internal image registry is exposed or not -
# Check If Internal Registry is installed or not oc get route -n openshift-image-registry -o jsonpath='{.items[*].spec.host}{"\n"}'
2. Above command will show the default route for Images, this means, Internal registry is exposed to access, if not, we can expose it by running below command, which will be requiring "cluster-admin" role. So, Either you or OCP admin can run the below command -
# Double check the python image location in internal by below command - oc get is/python -n openshift -o jsonpath='{.status.publicDockerImageRepository}{"\n"}' # Expose Internal Image registry oc patch config cluster -n openshift-image-registry --type merge -p '{"spec":{"defaultRoute":true}}'
3. Login with Podman or Docker
# Once exposed, You can access the image registry by below commands - OCPUSER=$(oc whoami) TOKEN=$(oc whoami -t) INTERNAL_REGISTRY=$(oc get route -n openshift-image-registry -o jsonpath='{.items[*].spec.host}{"\n"}') podman login ${INTERNAL_REGISTRY} -u ${OCPUSER} -p ${TOKEN}
4. Test the connection by pulling or pushing any image to OCP registry
# To Test podman pull ${INTERNAL_REGISTRY}/openshift/python:latest
Now, you can use internal registry like any other image registry.
No comments:
Post a Comment