11장. Red Hat Quay Operator에서 관리하는 Red Hat Quay 백업 및 복원
이 섹션의 콘텐츠를 사용하여 OpenShift Container Platform의 Red Hat Quay Operator에서 관리할 때 Red Hat Quay를 백업 및 복원합니다.
11.1. Red Hat Quay 백업 링크 복사링크가 클립보드에 복사되었습니다!
다음 절차에서는 Red Hat Quay Operator를 사용하여 OpenShift Container Platform에 배포된 Red Hat Quay의 백업을 생성하는 방법을 설명합니다.
사전 요구 사항
-
Red Hat Quay Operator를 사용하여 OpenShift Container Platform에 정상적인 Red Hat Quay 배포 (상태 조건
Availableis set totrue) -
구성 요소
quay,postgres및objectstorage는managed: true로 설정됩니다. -
구성 요소
clair가managed: true로 설정된 경우 구성 요소clairpostgres도managed: true로 설정됩니다(Red Hat Quay Operator v3.7 이상으로 시작)
배포에 부분적으로 관리되지 않는 데이터베이스 또는 스토리지 구성 요소가 포함되어 있고 Postgres 또는 S3 호환 오브젝트 스토리지에 외부 서비스를 사용하여 Red Hat Quay 배포를 실행하는 경우, 데이터 백업을 생성하려면 서비스 공급자 또는 벤더 설명서를 참조해야 합니다. 이 가이드에 설명된 툴을 외부 Postgres 데이터베이스 또는 오브젝트 스토리지를 백업하는 방법에 대한 시작점으로 참조할 수 있습니다.
11.1.1. Red Hat Quay 구성 백업 링크 복사링크가 클립보드에 복사되었습니다!
QuayRegistry사용자 정의 리소스를 내보내십시오.$ oc get quayregistry <quay-registry-name> -n <quay-namespace> -o yaml > quay-registry.yaml결과
quayregistry.yaml을 편집하고 status 섹션 및 다음 메타데이터 필드를 제거합니다.metadata.creationTimestamp metadata.finalizers metadata.generation metadata.resourceVersion metadata.uid관리형 키 시크릿을 백업합니다.
참고Red Hat Quay 3.7.0 이전 버전을 실행하는 경우 이 단계를 건너뜁니다. 일부 시크릿은 Quay를 처음 배포하는 동안 자동으로 생성됩니다. 이는
QuayRegistry리소스의 네임스페이스에서 <quay-registry-name>-quay-registry-managed-secret-keys라는 시크릿에 저장됩니다.$ oc get secret -n <quay-namespace> <quay-registry-name>-quay-registry-managed-secret-keys -o yaml > managed-secret-keys.yaml결과
managed-secret-keys.yaml파일을 편집하고metadata.ownerReferences항목을 제거합니다.managed-secret-keys.yaml파일은 다음과 유사해야 합니다.apiVersion: v1 kind: Secret type: Opaque metadata: name: <quayname>-quay-registry-managed-secret-keys namespace: <quay-namespace> data: CONFIG_EDITOR_PW: <redacted> DATABASE_SECRET_KEY: <redacted> DB_ROOT_PW: <redacted> DB_URI: <redacted> SECRET_KEY: <redacted> SECURITY_SCANNER_V4_PSK: <redacted>데이터속성의 모든 정보는 동일하게 유지되어야 합니다.현재 Quay 구성을 백업합니다.
$ oc get secret -n <quay-namespace> $(oc get quayregistry <quay-registry-name> -n <quay-namespace> -o jsonpath='{.spec.configBundleSecret}') -o yaml > config-bundle.yamlQuay 포드 내부에 마운트된
/conf/stack/config.yaml파일을 백업합니다.$ oc exec -it quay-pod-name -- cat /conf/stack/config.yaml > quay-config.yaml
11.1.2. Red Hat Quay 배포 축소 링크 복사링크가 클립보드에 복사되었습니다!
이 단계는 Red Hat Quay 배포 상태의 일관된 백업을 생성하는 데 필요합니다. Postgres 데이터베이스 및/또는 S3 호환 오브젝트 스토리지를 외부 서비스(Operator에서 관리하지 않음)에서 제공하는 설정을 포함하여 이 단계를 생략하지 마십시오.
Operator 버전 3.7 이상: 자동 확장을 비활성화하고 Red Hat Quay, 미러 작업자 및 Clair(관리된 경우)의 복제본 수를 재정의하여 Red Hat Quay 배포를 축소합니다.
QuayRegistry리소스는 다음과 유사해야 합니다.apiVersion: quay.redhat.com/v1 kind: QuayRegistry metadata: name: registry namespace: ns spec: components: … - kind: horizontalpodautoscaler managed: false1 - kind: quay managed: true overrides:2 replicas: 0 - kind: clair managed: true overrides: replicas: 0 - kind: mirror managed: true overrides: replicas: 0 …Operator 버전 3.6 및 이전 버전의 경우: Red Hat Quay Operator를 먼저 축소한 다음 관리되는 Red Hat Quay 리소스를 확장하여 Red Hat Quay 배포를 축소합니다.
$ oc scale --replicas=0 deployment $(oc get deployment -n <quay-operator-namespace>|awk '/^quay-operator/ {print $1}') -n <quay-operator-namespace> $ oc scale --replicas=0 deployment $(oc get deployment -n <quay-namespace>|awk '/quay-app/ {print $1}') -n <quay-namespace> $ oc scale --replicas=0 deployment $(oc get deployment -n <quay-namespace>|awk '/quay-mirror/ {print $1}') -n <quay-namespace> $ oc scale --replicas=0 deployment $(oc get deployment -n <quay-namespace>|awk '/clair-app/ {print $1}') -n <quay-namespace>registry-quay-app,registry-quay-mirror및registry-clair-app포드(Red Hat Quay Operator에서 관리하도록 설정한 구성 요소에 따라)가 사라질 때까지 기다립니다. 다음 명령을 실행하여 상태를 확인할 수 있습니다.$ oc get pods -n <quay-namespace>출력 예:
$ oc get pod quay-operator.v3.7.1-6f9d859bd-p5ftc 1/1 Running 0 12m quayregistry-clair-postgres-7487f5bd86-xnxpr 1/1 Running 1 (12m ago) 12m quayregistry-quay-app-upgrade-xq2v6 0/1 Completed 0 12m quayregistry-quay-config-editor-6dfdcfc44f-hlvwm 1/1 Running 0 73s quayregistry-quay-database-859d5445ff-cqthr 1/1 Running 0 12m quayregistry-quay-redis-84f888776f-hhgms 1/1 Running 0 12m
11.1.3. Red Hat Quay 관리 데이터베이스 백업 링크 복사링크가 클립보드에 복사되었습니다!
Red Hat Quay 배포가 외부(비밀리) Postgres 데이터베이스로 구성된 경우 공급업체의 문서를 참조하여 이러한 데이터베이스의 일관된 백업을 생성합니다.
Quay PostgreSQL 포드 이름을 식별합니다.
$ oc get pod -l quay-component=postgres -n <quay-namespace> -o jsonpath='{.items[0].metadata.name}'출력 예:
quayregistry-quay-database-59f54bb7-58xs7Quay 데이터베이스 이름을 가져옵니다.
$ oc -n <quay-namespace> rsh $(oc get pod -l app=quay -o NAME -n <quay-namespace> |head -n 1) cat /conf/stack/config.yaml|awk -F"/" '/^DB_URI/ {print $4}' quayregistry-quay-database백업 데이터베이스를 다운로드합니다.
$ oc exec quayregistry-quay-database-59f54bb7-58xs7 -- /usr/bin/pg_dump -C quayregistry-quay-database > backup.sql
11.1.3.1. Red Hat Quay 관리 개체 스토리지 백업 링크 복사링크가 클립보드에 복사되었습니다!
이 섹션의 지침은 다음 구성에 적용됩니다.
- 독립형 다중 클라우드 오브젝트 게이트웨이 구성
- OpenShift Data Foundations 스토리지에서는 Red Hat Quay Operator가 ObjectStorageBucketClaim API를 통해 S3 오브젝트 스토리지 버킷을 프로비저닝해야 합니다.
Red Hat Quay 배포가 외부(비밀리) 오브젝트 스토리지로 구성된 경우, Quay 스토리지 버킷의 콘텐츠 사본을 생성하는 방법에 대한 공급 업체의 설명서를 참조하십시오.
AWS_ACCESS_KEY_ID를 디코딩하고 내보냅니다.$ export AWS_ACCESS_KEY_ID=$(oc get secret -l app=noobaa -n <quay-namespace> -o jsonpath='{.items[0].data.AWS_ACCESS_KEY_ID}' |base64 -d)AWS_SECRET_ACCESS_KEY_ID를 디코딩하고 내보냅니다.$ export AWS_SECRET_ACCESS_KEY=$(oc get secret -l app=noobaa -n <quay-namespace> -o jsonpath='{.items[0].data.AWS_SECRET_ACCESS_KEY}' |base64 -d)새 디렉터리를 만들고 모든 Blob을 복사합니다.
$ mkdir blobs $ aws s3 sync --no-verify-ssl --endpoint https://$(oc get route s3 -n openshift-storage -o jsonpath='{.spec.host}') s3://$(oc get cm -l app=noobaa -n <quay-namespace> -o jsonpath='{.items[0].data.BUCKET_NAME}') ./blobs
11.1.4. Red Hat Quay 배포 백업 확장 링크 복사링크가 클립보드에 복사되었습니다!
Operator 버전 3.7 이상: 필요에 따라 자동 스케일링을 재활성화하고 Quay, 미러 작업자 및 Clair에 대한 복제본 덮어쓰기를 제거하여 Red Hat Quay 배포를 확장합니다.
QuayRegistry리소스는 다음과 유사해야 합니다.apiVersion: quay.redhat.com/v1 kind: QuayRegistry metadata: name: registry namespace: ns spec: components: … - kind: horizontalpodautoscaler managed: true1 - kind: quay2 managed: true - kind: clair managed: true - kind: mirror managed: true …Operator 버전 3.6 이하의 경우: Red Hat Quay Operator를 다시 확장하여 Red Hat Quay 배포를 확장합니다.
$ oc scale --replicas=1 deployment $(oc get deployment -n <quay-operator-namespace> | awk '/^quay-operator/ {print $1}') -n <quay-operator-namespace>Red Hat Quay 배포 상태를 확인합니다.
$ oc wait quayregistry registry --for=condition=Available=true -n <quay-namespace>출력 예:
apiVersion: quay.redhat.com/v1 kind: QuayRegistry metadata: ... name: registry namespace: <quay-namespace> ... spec: ... status: - lastTransitionTime: '2022-06-20T05:31:17Z' lastUpdateTime: '2022-06-20T17:31:13Z' message: All components reporting as healthy reason: HealthChecksPassing status: 'True' type: Available