4장. Quay Operator를 사용하여 Quay 배포
Operator는 명령줄 또는 OpenShift 콘솔에서 배포할 수 있지만 기본 단계는 동일합니다.
4.1. 명령줄에서 Red Hat Quay 배포 링크 복사링크가 클립보드에 복사되었습니다!
-
네임스페이스(예:
quay-enterprise)를 생성합니다. - 배포의 모든 측면을 사전 구성하려면 구성 번들에 대한 시크릿을 생성합니다.
quayregistry.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프록시가 구성된 경우 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.yaml- 배포 진행 상황을 추적하는 방법에 대한 자세한 내용은 배포 프로세스 모니터링 및 디버깅 섹션을 참조하십시오.
status.registryEndpoint가 채워질 때까지 기다립니다.$ oc get quayregistry -n quay-enterprise example-registry -o jsonpath="{.status.registryEndpoint}" -w
4.1.1. 명령줄을 사용하여 생성된 구성 요소 보기 링크 복사링크가 클립보드에 복사되었습니다!
oc get pods 명령을 사용하여 배포된 구성 요소를 확인합니다.
$ 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-config-editor-597b47c995-svqrl 1/1 Running 0 3m42s
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
4.1.2. HPA(Horizontal Pod Autoscaling) 링크 복사링크가 클립보드에 복사되었습니다!
기본 배포에는 다음과 같은 실행 중인 Pod가 표시됩니다.
-
Quay 애플리케이션 자체에 대한 두 개의 포드(
example-registry-quay-app-*') -
Quay 로깅을 위한 하나의 Redis Pod(
example-registry-quay-redis-*) -
Quay에서 메타데이터 스토리지에 사용하는 PostgreSQL 데이터베이스 포드 1개(
example-registry-quay-database-*) -
Quay 구성 편집기에 대한 하나의 Pod(
example-registry-quay-config-editor-*) -
두 개의 Quay 미러링 Pod (
example-registry-quay-mirror-*) -
Clair 애플리케이션에 대한 두 개의 포드(
example-registry-clair-app-*) -
Clair용 PostgreSQL Pod 1개(
예-registry-clair-postgres-*)
HPA는 기본적으로 관리 되도록 구성되므로 Quay, Clair 및 저장소 미러링의 Pod 수는 2로 설정됩니다. 이를 통해 Operator 또는 일정 기간 동안 Quay를 업데이트/구성할 때 다운타임을 방지할 수 있습니다.
$ 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
4.1.3. API를 사용하여 Red Hat Quay 배포 링크 복사링크가 클립보드에 복사되었습니다!
이 섹션에서는 API를 사용하여 Red Hat Quay를 배포하는 방법을 설명합니다.
사전 요구 사항
-
설정 옵션
FEATURE_USER_INITIALIZE를true로 설정해야 합니다. - 데이터베이스에 이미 사용자가 있을 수 없습니다.
Red Hat Quay 배포 사전 구성에 대한 자세한 내용은 자동화를 위한 Red Hat Quay 사전 구성 섹션을참조하십시오.
4.1.3.1. API를 사용하여 첫 번째 사용자 생성 링크 복사링크가 클립보드에 복사되었습니다!
다음 절차에 따라 Red Hat Quay 조직에 첫 번째 사용자를 생성합니다.
이 절차에서는 "access_token": true 를 지정하여 OAuth 토큰을 요청합니다.
status.registryEndpointURL을 사용하여/api/v1/user/initializeAPI를 호출하고 다음 명령을 입력하여 사용자 이름, 암호 및 이메일 주소를 전달합니다.$ curl -X POST -k https://example-registry-quay-quay-enterprise.apps.docs.quayteam.org/api/v1/user/initialize --header 'Content-Type: application/json' --data '{ "username": "quayadmin", "password":"quaypass123", "email": "quayadmin@example.com", "access_token": true}'성공하면 명령은 사용자 이름, 이메일 및 암호화된 암호를 사용하여 오브젝트를 반환합니다. 예를 들면 다음과 같습니다.
{"access_token":"6B4QTRSTSD1HMIG915VPX7BMEZBVB9GPNY2FC2ED", "email":"quayadmin@example.com","encrypted_password":"1nZMLH57RIE5UGdL/yYpDOHLqiNCgimb6W9kfF8MjZ1xrfDpRyRs9NUnUuNuAitW","username":"quayadmin"}사용자가 이미 데이터베이스에 있으면 오류가 반환됩니다.
{"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."}
4.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
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-config-editor-5f646cbcb7-lbnc2 0/1 ContainerCreating 0 17s
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
configEditorCredentialsSecret: example-registry-quay-config-editor-credentials-btbkcg8dc9
configEditorEndpoint: https://example-registry-quay-config-editor-quay-enterprise.apps.docs.quayteam.org
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
configEditorCredentialsSecret: example-registry-quay-config-editor-credentials-hg7gg7h57m
configEditorEndpoint: https://example-registry-quay-config-editor-quay-enterprise.apps.docs.quayteam.org
currentVersion: {producty}
lastUpdated: 2021-09-14 10:52:46.104181633 +0000 UTC
registryEndpoint: https://example-registry-quay-quay-enterprise.apps.docs.quayteam.org
unhealthyComponents: {}