7장. Operator를 사용하여 Red Hat Quay 배포
OpenShift Container Platform의 Red Hat Quay는 명령줄 인터페이스 또는 OpenShift Container Platform 콘솔을 사용하여 배포할 수 있습니다. 단계는 근본적으로 동일합니다.
7.1. 명령줄에서 Red Hat Quay 배포 링크 복사링크가 클립보드에 복사되었습니다!
다음 절차에 따라 CLI(명령줄 인터페이스)를 사용하여 에서 Red Hat Quay를 배포합니다.
사전 요구 사항
- CLI를 사용하여 OpenShift Container Platform에 로그인했습니다.
프로세스
다음 명령을 입력하여 네임스페이스(예:
quay-enterprise)를 만듭니다.$ oc new-project quay-enterprise선택 사항: Red Hat Quay 배포의 모든 측면을 사전 구성하려면 구성 번들에
대한보안을 생성합니다.$ oc create secret generic quay-enterprise-config-bundle --from-file=config-bundle.tar.gz=/path/to/config-bundle.tar.gzquayregistry.yaml이라는 파일에QuayRegistry사용자 정의 리소스를 생성최소 배포의 경우 모든 기본값을 사용합니다.
quayregistry.yaml:
apiVersion: quay.redhat.com/v1 kind: QuayRegistry metadata: name: example-registry namespace: quay-enterprise선택 사항: 일부 구성 요소가 관리되지 않도록 하려면
spec필드에 이 정보를 추가합니다. 최소 배포는 다음 예와 같을 수 있습니다.관리되지 않는 구성 요소가 있는 quayregistry.yaml의 예
apiVersion: quay.redhat.com/v1 kind: QuayRegistry metadata: name: example-registry namespace: quay-enterprise spec: components: - kind: clair managed: false - kind: horizontalpodautoscaler managed: false - kind: mirror managed: false - kind: monitoring managed: false선택 사항: 구성 번들을 생성한 경우(예:
init-config-bundle-secret)quayregistry.yaml파일에서 참조합니다.구성 번들이 포함된 quayregistry.yaml 예
apiVersion: quay.redhat.com/v1 kind: QuayRegistry metadata: name: example-registry namespace: quay-enterprise spec: configBundleSecret: init-config-bundle-secret선택 사항: 프록시가 구성된 경우 Red Hat Quay, Clair, 미러링에 대한 재정의를 사용하여 정보를 추가할 수 있습니다.
프록시가 구성된 quayregistry.yaml 예
kind: QuayRegistry metadata: name: quay37 spec: configBundleSecret: config-bundle-secret components: - kind: objectstorage managed: false - kind: route managed: true - kind: mirror managed: true overrides: env: - name: DEBUGLOG value: "true" - name: HTTP_PROXY value: quayproxy.qe.devcluster.openshift.com:3128 - name: HTTPS_PROXY value: quayproxy.qe.devcluster.openshift.com:3128 - name: NO_PROXY value: svc.cluster.local,localhost,quay370.apps.quayperf370.perfscale.devcluster.openshift.com - kind: tls managed: false - kind: clair managed: true overrides: env: - name: HTTP_PROXY value: quayproxy.qe.devcluster.openshift.com:3128 - name: HTTPS_PROXY value: quayproxy.qe.devcluster.openshift.com:3128 - name: NO_PROXY value: svc.cluster.local,localhost,quay370.apps.quayperf370.perfscale.devcluster.openshift.com - kind: quay managed: true overrides: env: - name: DEBUGLOG value: "true" - name: NO_PROXY value: svc.cluster.local,localhost,quay370.apps.quayperf370.perfscale.devcluster.openshift.com - name: HTTP_PROXY value: quayproxy.qe.devcluster.openshift.com:3128 - name: HTTPS_PROXY value: quayproxy.qe.devcluster.openshift.com:3128
다음 명령을 입력하여 지정된 네임스페이스에
QuayRegistry를 생성합니다.$ oc create -n quay-enterprise -f quayregistry.yamlstatus.registryEndpoint가 채워지는 시기를 확인하려면 다음 명령을 입력합니다.$ oc get quayregistry -n quay-enterprise example-registry -o jsonpath="{.status.registryEndpoint}" -w
추가 리소스
- Red Hat Quay 배포의 진행 상황을 추적하는 방법에 대한 자세한 내용은 배포 프로세스 모니터링 및 디버깅을 참조하십시오.
7.1.1. API를 사용하여 첫 번째 사용자 생성 링크 복사링크가 클립보드에 복사되었습니다!
다음 절차에 따라 Red Hat Quay 조직에 첫 번째 사용자를 생성합니다.
사전 요구 사항
-
구성 옵션
FEATURE_USER_INITIALIZE를True로 설정해야 합니다. - 데이터베이스에 이미 존재하지 않는 사용자가 없습니다.
이 절차에서는 "access_token": true 를 지정하여 OAuth 토큰을 요청합니다.
Red Hat Quay 구성 파일을 열고 다음 구성 필드를 업데이트합니다.
FEATURE_USER_INITIALIZE: true SUPER_USERS: - quayadmin다음 명령을 입력하여 Red Hat Quay 서비스를 중지합니다.
$ sudo podman stop quay다음 명령을 입력하여 Red Hat Quay 서비스를 시작합니다.
$ sudo podman run -d -p 80:8080 -p 443:8443 --name=quay -v $QUAY/config:/conf/stack:Z -v $QUAY/storage:/datastorage:Z {productrepo}/{quayimage}:{productminv}다음
CURL명령을 실행하여 사용자 이름, 암호, 이메일 및 액세스 토큰이 있는 새 사용자를 생성합니다.$ curl -X POST -k http://quay-server.example.com/api/v1/user/initialize --header 'Content-Type: application/json' --data '{ "username": "quayadmin", "password":"quaypass12345", "email": "quayadmin@example.com", "access_token": true}'성공하면 명령은 사용자 이름, 이메일 및 암호화된 암호를 사용하여 오브젝트를 반환합니다. 예를 들면 다음과 같습니다.
{"access_token":"6B4QTRSTSD1HMIG915VPX7BMEZBVB9GPNY2FC2ED", "email":"quayadmin@example.com","encrypted_password":"1nZMLH57RIE5UGdL/yYpDOHLqiNCgimb6W9kfF8MjZ1xrfDpRyRs9NUnUuNuAitW","username":"quayadmin"} # gitleaks:allow사용자가 데이터베이스에 이미 있는 경우 오류가 반환됩니다.
{"message":"Cannot initialize user in a non-empty database"}암호가 8자 이상이어야 하거나 공백을 포함하는 경우 오류가 반환됩니다.
{"message":"Failed to initialize user: Invalid password, password must be at least 8 characters and contain no whitespace."}다음 명령을 입력하여 Red Hat Quay 배포에 로그인합니다.
$ sudo podman login -u quayadmin -p quaypass12345 http://quay-server.example.com --tls-verify=false출력 예
Login Succeeded!
7.1.2. 명령줄을 사용하여 생성된 구성 요소 보기 링크 복사링크가 클립보드에 복사되었습니다!
배포된 Red Hat Quay 구성 요소를 보려면 다음 절차를 사용하십시오.
사전 요구 사항
- OpenShift Container Platform에 Red Hat Quay를 배포했습니다.
프로세스
배포된 구성 요소를 보려면 다음 명령을 입력합니다.
$ oc get pods -n quay-enterprise출력 예
NAME READY STATUS RESTARTS AGE example-registry-clair-app-5ffc9f77d6-jwr9s 1/1 Running 0 3m42s example-registry-clair-app-5ffc9f77d6-wgp7d 1/1 Running 0 3m41s example-registry-clair-postgres-54956d6d9c-rgs8l 1/1 Running 0 3m5s example-registry-quay-app-79c6b86c7b-8qnr2 1/1 Running 4 3m42s example-registry-quay-app-79c6b86c7b-xk85f 1/1 Running 4 3m41s example-registry-quay-app-upgrade-5kl5r 0/1 Completed 4 3m50s example-registry-quay-database-b466fc4d7-tfrnx 1/1 Running 2 3m42s example-registry-quay-mirror-6d9bd78756-6lj6p 1/1 Running 0 2m58s example-registry-quay-mirror-6d9bd78756-bv6gq 1/1 Running 0 2m58s example-registry-quay-postgres-init-dzbmx 0/1 Completed 0 3m43s example-registry-quay-redis-8bd67b647-skgqx 1/1 Running 0 3m42s
7.1.3. 수평 Pod 자동 스케일링 링크 복사링크가 클립보드에 복사되었습니다!
기본 배포에는 다음과 같은 실행 중인 Pod가 표시됩니다.
-
Red Hat Quay 애플리케이션 자체를 위한 두 개의 Pod(
예:-registry-quay-app-*') -
Red Hat Quay 로깅을 위한 하나의 Redis Pod (
예:-registry-quay-redis-*) -
메타데이터 스토리지에 Red Hat Quay에서 사용하는 PostgreSQL용 데이터베이스 포드 1개(
예:-registry-quay-database-*) -
두 개의
Quay미러링 Pod(example-registry-quay-mirror-*) -
Clair 애플리케이션을 위한 두 개의 Pod(
예:-registry-clair-app-*) -
Clair를 위한 하나의 PostgreSQL Pod(
example-registry-clair-postgres-*)
수평 PPod 자동 확장은 기본적으로 관리 되도록 구성되며 Quay, Clair 및 리포지토리 미러링의 Pod 수는 2로 설정됩니다. 이를 통해 Red Hat Quay Operator 또는 일정 조정 이벤트를 통해 Red Hat Quay를 업데이트하거나 재구성할 때 다운타임을 방지할 수 있습니다. 다음 명령을 입력하여 HPA 오브젝트에 대한 정보를 볼 수 있습니다.
$ oc get hpa -n quay-enterprise
출력 예
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
example-registry-clair-app Deployment/example-registry-clair-app 16%/90%, 0%/90% 2 10 2 13d
example-registry-quay-app Deployment/example-registry-quay-app 31%/90%, 1%/90% 2 20 2 13d
example-registry-quay-mirror Deployment/example-registry-quay-mirror 27%/90%, 0%/90% 2 20 2 13d
7.1.4. 배포 프로세스 모니터링 및 디버깅 링크 복사링크가 클립보드에 복사되었습니다!
사용자는 배포 단계에서 문제를 해결할 수 있습니다. QuayRegistry 오브젝트의 상태는 배포 중에 구성 요소의 상태를 모니터링하는 데 도움이 될 수 있으며 발생할 수 있는 문제를 디버깅하는 데 도움이 될 수 있습니다.
프로세스
다음 명령을 입력하여 배포 상태를 확인합니다.
$ oc get quayregistry -n quay-enterprise -o yaml출력 예
배포 직후
QuayRegistry오브젝트에는 기본 설정이 표시됩니다.apiVersion: v1 items: - apiVersion: quay.redhat.com/v1 kind: QuayRegistry metadata: creationTimestamp: "2021-09-14T10:51:22Z" generation: 3 name: example-registry namespace: quay-enterprise resourceVersion: "50147" selfLink: /apis/quay.redhat.com/v1/namespaces/quay-enterprise/quayregistries/example-registry uid: e3fc82ba-e716-4646-bb0f-63c26d05e00e spec: components: - kind: postgres managed: true - kind: clair managed: true - kind: redis managed: true - kind: horizontalpodautoscaler managed: true - kind: objectstorage managed: true - kind: route managed: true - kind: mirror managed: true - kind: monitoring managed: true - kind: tls managed: true - kind: clairpostgres managed: true configBundleSecret: example-registry-config-bundle-kt55s kind: List metadata: resourceVersion: "" selfLink: ""배포된 구성 요소의 현재 상태를 보려면
oc get pods명령을 사용합니다.$ oc get pods -n quay-enterprise출력 예
NAME READY STATUS RESTARTS AGE example-registry-clair-app-86554c6b49-ds7bl 0/1 ContainerCreating 0 2s example-registry-clair-app-86554c6b49-hxp5s 0/1 Running 1 17s example-registry-clair-postgres-68d8857899-lbc5n 0/1 ContainerCreating 0 17s example-registry-quay-app-upgrade-h2v7h 0/1 ContainerCreating 0 9s example-registry-quay-database-66f495c9bc-wqsjf 0/1 ContainerCreating 0 17s example-registry-quay-mirror-854c88457b-d845g 0/1 Init:0/1 0 2s example-registry-quay-mirror-854c88457b-fghxv 0/1 Init:0/1 0 17s example-registry-quay-postgres-init-bktdt 0/1 Terminating 0 17s example-registry-quay-redis-f9b9d44bf-4htpz 0/1 ContainerCreating 0 17s배포가 진행 중인 동안
QuayRegistry오브젝트에 현재 상태가 표시됩니다. 이 경우 데이터베이스 마이그레이션이 수행되고 기타 구성 요소가 완료될 때까지 대기 중입니다.status: conditions: - lastTransitionTime: "2021-09-14T10:52:04Z" lastUpdateTime: "2021-09-14T10:52:04Z" message: all objects created/updated successfully reason: ComponentsCreationSuccess status: "False" type: RolloutBlocked - lastTransitionTime: "2021-09-14T10:52:05Z" lastUpdateTime: "2021-09-14T10:52:05Z" message: running database migrations reason: MigrationsInProgress status: "False" type: Available lastUpdated: 2021-09-14 10:52:05.371425635 +0000 UTC unhealthyComponents: clair: - lastTransitionTime: "2021-09-14T10:51:32Z" lastUpdateTime: "2021-09-14T10:51:32Z" message: 'Deployment example-registry-clair-postgres: Deployment does not have minimum availability.' reason: MinimumReplicasUnavailable status: "False" type: Available - lastTransitionTime: "2021-09-14T10:51:32Z" lastUpdateTime: "2021-09-14T10:51:32Z" message: 'Deployment example-registry-clair-app: Deployment does not have minimum availability.' reason: MinimumReplicasUnavailable status: "False" type: Available mirror: - lastTransitionTime: "2021-09-14T10:51:32Z" lastUpdateTime: "2021-09-14T10:51:32Z" message: 'Deployment example-registry-quay-mirror: Deployment does not have minimum availability.' reason: MinimumReplicasUnavailable status: "False" type: Available배포 프로세스가 완료되면
QuayRegistry오브젝트의 상태가 비정상 구성 요소를 표시하지 않습니다.status: conditions: - lastTransitionTime: "2021-09-14T10:52:36Z" lastUpdateTime: "2021-09-14T10:52:36Z" message: all registry component healthchecks passing reason: HealthChecksPassing status: "True" type: Available - lastTransitionTime: "2021-09-14T10:52:46Z" lastUpdateTime: "2021-09-14T10:52:46Z" message: all objects created/updated successfully reason: ComponentsCreationSuccess status: "False" type: RolloutBlocked currentVersion: {producty} lastUpdated: 2021-09-14 10:52:46.104181633 +0000 UTC registryEndpoint: https://example-registry-quay-quay-enterprise.apps.docs.quayteam.org unhealthyComponents: {}