Skip to content

Instantly share code, notes, and snippets.

@jkeam
Created September 23, 2021 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkeam/bd6c644fa03ccf7e68fce68b34db2720 to your computer and use it in GitHub Desktop.
Save jkeam/bd6c644fa03ccf7e68fce68b34db2720 to your computer and use it in GitHub Desktop.
Deploying OpenShift with Internal Registry

Deploying OpenShift App From Internal Registry

This describes the steps on how to push an image to your local OpenShift cluster; specifically the internal registry; and then deploy that.

Prerequisites

  1. You are logged into the cluster
  2. You have the image to push to the cluster on your local computer
docker pull quay.io/jkeam/hello-python

Instructions

  1. Make Internal Registry Public
oc patch configs.imageregistry.operator.openshift.io/cluster --patch '{"spec":{"defaultRoute":true}}' --type=merge
  1. Give Yourself Access - Assuming you are logged in as opentlc-mgr
oc policy add-role-to-user registry-viewer opentlc-mgr
oc policy add-role-to-user registry-editor opentlc-mgr
  1. Create project/namespace
oc new-project jon
  1. Login
HOST=$(oc get route default-route -n openshift-image-registry --template='{{ .spec.host }}')
# podman login -u kubeadmin -p $(oc whoami -t) --tls-verify=false $HOST 
docker login -u kubeadmin -p $(oc whoami -t) $HOST 
  1. Tag Image, notice jon is the project and hello-python is the image name
docker tag quay.io/jkeam/hello-python $HOST/jon/hello-python
  1. Push Image
docker push $HOST/jon/hello-python
  1. Use the following in your deployment.yaml
image: image-registry.openshift-image-registry.svc:5000/jon/hello-python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment