검색

12.5. 미러 레지스트리의 클러스터 설정

download PDF

이미지를 생성하고 미러 레지스트리로 미러링한 후 Pod가 미러 레지스트리에서 이미지를 가져올 수 있도록 클러스터를 수정해야 합니다.

다음을 수행해야 합니다.

  • 미러 레지스트리 인증 정보를 글로벌 풀 시크릿에 추가합니다.
  • 미러 레지스트리 서버 인증서를 클러스터에 추가합니다.
  • 미러 레지스트리를 소스 레지스트리와 연결하는 ImageContentSourcePolicy 사용자 정의 리소스(ICSP)를 생성합니다.

    1. 글로벌 풀 풀 시크릿에 미러 레지스트리 인증 정보를 추가합니다.

      $ oc set data secret/pull-secret -n openshift-config --from-file=.dockerconfigjson=<pull_secret_location> 1
      1
      새 풀 시크릿 파일의 경로를 제공합니다.

      예를 들어 다음과 같습니다.

      $ oc set data secret/pull-secret -n openshift-config --from-file=.dockerconfigjson=.mirrorsecretconfigjson
    2. CA 서명된 미러 레지스트리 서버 인증서를 클러스터의 노드에 추가합니다.

      1. 미러 레지스트리의 서버 인증서가 포함된 구성 맵 생성

        $ oc create configmap <config_map_name> --from-file=<mirror_address_host>..<port>=$path/ca.crt -n openshift-config

        예를 들어 다음과 같습니다.

        S oc create configmap registry-config --from-file=mirror.registry.com..443=/root/certs/ca-chain.cert.pem -n openshift-config
      2. 구성 맵을 사용하여 image.config.openshift.io/cluster 사용자 정의 리소스(CR)를 업데이트합니다. OpenShift Container Platform은 이 CR에 대한 변경 사항을 클러스터의 모든 노드에 적용합니다.

        $ oc patch image.config.openshift.io/cluster --patch '{"spec":{"additionalTrustedCA":{"name":"<config_map_name>"}}}' --type=merge

        예를 들어 다음과 같습니다.

        $ oc patch image.config.openshift.io/cluster --patch '{"spec":{"additionalTrustedCA":{"name":"registry-config"}}}' --type=merge
    3. ICSP를 생성하여 온라인 레지스트리에서 미러 레지스트리로 컨테이너 가져오기 요청을 리디렉션합니다.

      1. ImageContentSourcePolicy 사용자 정의 리소스를 생성합니다.

        apiVersion: operator.openshift.io/v1alpha1
        kind: ImageContentSourcePolicy
        metadata:
          name: mirror-ocp
        spec:
          repositoryDigestMirrors:
          - mirrors:
            - mirror.registry.com:443/ocp/release 1
            source: quay.io/openshift-release-dev/ocp-release 2
          - mirrors:
            - mirror.registry.com:443/ocp/release
            source: quay.io/openshift-release-dev/ocp-v4.0-art-dev
        1
        미러 이미지 레지스트리 및 저장소의 이름을 지정합니다.
        2
        미러링된 콘텐츠가 포함된 온라인 레지스트리 및 저장소를 지정합니다.
      2. ICSP 오브젝트를 생성합니다.

        $ oc create -f registryrepomirror.yaml

        출력 예

        imagecontentsourcepolicy.operator.openshift.io/mirror-ocp created

        OpenShift Container Platform은 이 CR에 대한 변경 사항을 클러스터의 모든 노드에 적용합니다.

    4. 미러 레지스트리의 인증 정보, CA 및 ICSP가 추가되었는지 확인합니다.

      1. 노드에 로그인합니다.

        $ oc debug node/<node_name>
      2. 디버그 쉘 내에서 /host를 root 디렉터리로 설정합니다.

        sh-4.4# chroot /host
      3. 인증 정보가 config.json 파일을 확인합니다.

        sh-4.4# cat /var/lib/kubelet/config.json

        출력 예

        {"auths":{"brew.registry.redhat.io":{"xx=="},"brewregistry.stage.redhat.io":{"auth":"xxx=="},"mirror.registry.com:443":{"auth":"xx="}}} 1

        1
        미러 레지스트리 및 인증 정보가 있는지 확인합니다.
      4. certs.d 디렉터리로 변경합니다.

        sh-4.4# cd /etc/docker/certs.d/
      5. certs.d 디렉터리에 인증서를 나열합니다.

        sh-4.4# ls

        출력 예

        image-registry.openshift-image-registry.svc.cluster.local:5000
        image-registry.openshift-image-registry.svc:5000
        mirror.registry.com:443 1

        1
        미러 레지스트리가 목록에 있는지 확인합니다.
      6. ICSP가 mirror 레지스트리를 registries.conf 파일에 추가했는지 확인합니다.

        sh-4.4# cat /etc/containers/registries.conf

        출력 예

        unqualified-search-registries = ["registry.access.redhat.com", "docker.io"]
        
        [[registry]]
          prefix = ""
          location = "quay.io/openshift-release-dev/ocp-release"
          mirror-by-digest-only = true
        
          [[registry.mirror]]
            location = "mirror.registry.com:443/ocp/release"
        
        [[registry]]
          prefix = ""
          location = "quay.io/openshift-release-dev/ocp-v4.0-art-dev"
          mirror-by-digest-only = true
        
          [[registry.mirror]]
            location = "mirror.registry.com:443/ocp/release"

        registry.mirror 매개변수는 미러 레지스트리가 원래 레지스트리보다 먼저 검색됨을 나타냅니다.

      7. 노드를 종료합니다.

        sh-4.4# exit
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.