Login and Import-Image from Redhat Registry to OKD/OCP4

Mindwatering Incorporated

Author: Tripp W Black

Created: 07/31 at 07:07 PM

 

Category:
RH OpenShift
Reference

Task


Publish a Red Hat image (e.g. an UBI image) to OCP4/OKD for a new app.

1. Set account w/Podman
a. Login to workstation w/oc:
$ ssh myadminid@jumpbox.mindwatering.net
<enter password if not keys>

b. Login to Red Hat's registry:
$ podman login registry.redhat.io
Username: myrhusername@mindwatering.net
Password: <myrhpassword>
<view Login Succeeded message if correct>

Note:
- The password's authentication credential is stored in ${XDG_RUNTIME_DIR}/containers/auth.json
- To get that variable's value, issue: echo $XDG_RUNTIME_DIR

c. (Optional) View the authentication token:
$ echo $XDG_RUNTIME_DIR
/run/user/1000
$ cat /$XDG_RUNTIME_DIR/containers/auth.json
<view output - each registry has an "auth" entry>

c. Confirm what's in a registry:
Note:
- For an authenticated registry (e.g. registry.redhat.io), you have to pass the username and set the password in a variable and use it, etc.
$ curl -ks https://registry.access.redhat.com:443/v2/_catalog?n=5000 | jq
<review long list>

d. Test registry image pull:
$ podman pull registry.redhat.io/rhel8/<imagename>
<confirm downloaded>


2. Now that login is confirmed, lets do again for OCP:
a. Create the secret in OCP/OKD via oc create secret <pullsecretname>:
$ oc create secret docker-registry registry-redhat-io --docker-server=registry.redhat.io --docker-username=myrhusername@mindwatering.net --docker-password=<myrhpassword> --docker-email=myrhusername@mindwatering.net
<confirm secret/pullsecretname created>

b. Link the service account that the application uses (e.g. the application's parent project)
Note:
- Default application area out-of-the-box is default
- Add secret to the project(s)/namespace(s) required to deploy apps

$ oc secrets link myappsproject registry-redhat-io --for=pull
<no output if successful>

c. If needing to push images build images, the new secret must be referenced w/in the build configuration:
$ oc secrets link builder registry-redhat-io
<no output if successful>


previous page

×