Openshift: External registry

Page content

I this post I will demonstrate howyou can use an external registry in Openshift.

Parst of the Openshift series

Configuring Openshift

From your client machine, create a Kubernetes secret object for Harbor.:

oc new-proyect registrytest

oc create secret docker-registry harbor \
--docker-server=https://harbor.mydomain.intra \
--docker-username=admin \
--docker-email=admin@mydomain.intra \
--docker-password='[your_admin_harbor_password]'

If you want you can add this secret to the deafult template of the project creation.

Deploy the private image on the Openshift cluster

nano registrytest-deployment.yaml
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  labels:
    run: nginx
  name: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      run: nginx
  template:
    metadata:
      labels:
        run: nginx
    spec:
      containers:
      - image: harbor.mydomain.intra/test/nginx:V2
        name: nginx
      imagePullSecrets:
      - name: harbor

oc apply -f kuard-deployment.yaml
oc get pods
comments powered by Disqus