第 8 章 监控和调试部署过程
用户现在可以在部署阶段排除问题。QuayRegistry 对象中的状态可帮助您在部署期间监控组件的健康状况,以帮助您调试可能会出现任何问题。
步骤
输入以下命令检查部署的状态:
$ oc get quayregistry -n quay-enterprise -o yaml输出示例
部署后,Quay
Registry对象将显示基本配置: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-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在部署进行时,Quay
Registry对象将显示当前状态。在这个实例中,数据库迁移会被发生,其他组件会等到完成为止: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: {}
8.1. 从 OpenShift Container Platform 控制台部署 Red Hat Quay 复制链接链接已复制到粘贴板!
-
创建一个命名空间,如
quay-enterprise。 -
选择 Operators
Installed Operators,然后选择 Quay Operator 以导航到 Operator 详情视图。 - 在 'Provided APIs' 下的 'quay Registry' 上点 'Create Instance'。
-
(可选)更改
QuayRegistry的 'Name'。这将影响 registry 的主机名。所有其他字段都已填充默认值。 -
点 'Create' 提交
QuayRegistry以供 Quay Operator 部署。 -
您应该被重定向到
QuayRegistry列表视图。点您刚才创建的QuayRegistry以查看详情视图。 - 在 'Registry Endpoint' 有值后,可以在 UI 中点来访问新的 Quay registry。现在,您可以选择"Create Account"来创建用户并登录。
8.1.1. 使用 Red Hat Quay UI 创建第一个用户 复制链接链接已复制到粘贴板!
使用以下步骤,通过 Red Hat Quay UI 创建第一个用户。
此流程假设 FEATURE_USER_CREATION 配置选项没有设置为 false。如果为 False,则 UI 上的 Create Account 功能将被禁用,您必须使用 API 来创建第一个用户。
步骤
-
在 OpenShift Container Platform 控制台中,使用适当的命名空间 / 项目导航到 Operators
Installed Operators。 点新安装的
QuayRegistry对象查看详情。例如:
-
在
Registry Endpoint有值后,导航到浏览器中的这个 URL。 在 Red Hat Quay registry UI 中,选择 Create Account 来创建用户。例如:
输入用户名、密码、电子邮件 的详细信息,然后单击 Create Account。例如:
创建第一个用户后,会自动登录到 Red Hat Quay registry。例如: