본문 바로가기

CLOUD/Openshift

[Openshift 4.11.9] Restricted Network 환경에서 Operator HUB Catalog 추가

반응형

기존에는 Operator HUB를 사용시 opm CLI 도구를 사용하여 SQLite 기반의 Catalog를 사용하였습니다.

 

하지만 4.11.9에서는 File-based catalog를 사용합니다. 도구도 opm이 아닌 oc-mirror를 사용 하여야 합니다.

 

아래는 SQLite based 카탈로그 사용 중단 내용 입니다.

 

https://bugzilla.redhat.com/show_bug.cgi?id=2019570 

 

2019570 – OLM Pruning a SQLite-based index image Deprecated

 

bugzilla.redhat.com

 

 

 

1. oc-mirror CLI 도구 다운로드

 

wget https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/latest-4.11/oc-mirror.tar.gz

 

2. Tool install

 

tar xvzf oc-mirror.tar.gz
chmod +x oc-mirror
sudo mv oc-mirror /usr/local/bin/.
oc mirror help

 

 

 

3. pull-secret json 형식으로 변경

 

mkdir -p /root/.docker/
cat pull-secret | jq . > /root/.docker/config.json

 

pull-secret download 주소

 

https://console.redhat.com/openshift/install/pull-secret

 

console.redhat.com

 

console.redhat.com

 

 

4. 이미지 세트 구성 만들기

 

oc mirror init --registry example.com/mirror/oc-mirror-metadata > imageset-config.yaml 

kind: ImageSetConfiguration
apiVersion: mirror.openshift.io/v1alpha2
archiveSize: 4                                                      
storageConfig:                                                      
  registry:
    imageURL: example.com/mirror/oc-mirror-metadata                 
    skipTLS: false
mirror:
  platform:
    channels:
    - name: stable-4.11                                             
      type: ocp
    graph: true                                                     
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.11  
    packages:
    - name: serverless-operator                                     
      channels:
      - name: stable
  additionalImages:
  - name: registry.redhat.io/ubi8/ubi:latest                        
  helm: {}

 

 

5. 내부 registry로 mirroring

 

oc mirror --config=./imageset-config.yaml docker://registry.example:5000 

cd oc-mirror-workspace/results-1667456169/

 

 

 

적용

oc apply -f catalogSource-redhat-operator-index.yaml

oc apply -f imageContentSourcePolicy.yaml

 

 

6. 확인

 

oc get imagecontentsourcepolicy --all-namespaces
oc get catalogsource --all-namespaces

 

 

콘솔에서 operatorhub 검색되는지 확인

 

 

 

 

 

 

 

 

참조 사이트 :

https://docs.openshift.com/container-platform/4.11/installing/disconnected_install/installing-mirroring-disconnected.html#oc-mirror-creating-image-set-config_installing-mirroring-disconnected

 

Mirroring images for a disconnected installation using the oc-mirror plug-in - Disconnected installation mirroring | Installing

Before you can use the oc-mirror plug-in to mirror image sets, you must create an image set configuration file. This image set configuration file defines which OpenShift Container Platform releases, Operators, and other images to mirror, along with other c

docs.openshift.com

 

반응형