By default, when you install your openshift 4 cluster on bare metal manually, the internal image registry is not available, and the imagestream, buildconfigs may not working as you want, if you deploy a pod from the default template, the following error occured:
dial tcp: lookup image-registry.openshift-image-registry.svc on 192.168.3.20:53: no such host
The image-registry.openshift-image-registry.svc is a cluster internal svc name, this domain is configured by dns-node-resolver Daemonset to add it on /etc/hosts file of each node.
To start the image registry, you must change the Image Registry Operator configuration’s managementState
from Removed
to Managed
.
oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"managementState":"Managed"}}'
To add persistent storage to registry
oc edit configs.imageregistry.operator.openshift.io
leave storage.pvc.claim with empty value for default size (100G), also, you can specify your own storage pvc name
storage:
pvc:
claim:
and then check the clusteroperator of it
# oc get clusteroperator image-registry
AME VERSION AVAILABLE PROGRESSING DEGRADED SINCE MESSAGE
image-registry 4.10.46 True False False 14m
when its available state is true, it should be ready for use. and the error message above should be gone.