基础设施即代码(IAC),Zalando Postgres Operator UI 入门

2023-03-15,,

Postgres Operator UI 提供了一个图形界面,方便用户体验数据库即服务。一旦 database 和/或 Kubernetes (K8s) 管理员设置了 operator,其他团队就很容易创建、克隆、监视、编辑和删除自己的 Postgres 集群。有关设置和技术细节的信息可以在 admin 文档中找到。

admin 文档: https://postgres-operator.readthedocs.io/en/latest/administrator/#setting-up-the-postgres-operator-ui

创建一个新集群

在顶部菜单中选择 New cluster 选项并调整文本字段中的值。 集群名称由团队给定名称组成。 可用选项包括启用负载均衡器卷大小用户和数据库以及 pod 资源

启用负载均衡器: https://postgres-operator.readthedocs.io/en/latest/administrator/#load-balancers-and-allowed-ip-ranges
卷大小:https://postgres-operator.readthedocs.io/en/latest/user/#increase-volume-size
用户和数据库:https://postgres-operator.readthedocs.io/en/latest/user/#manifest-roles
pod 资源:https://postgres-operator.readthedocs.io/en/latest/operator-ui/cluster-manifest.md#postgres-container-resources

在左侧,您将看到 Postgres 集群清单的预览,当单击绿色的 Create cluster 按钮时应用该清单。

集群启动

清单应用于 K8s 后,Postgres Operator 将创建所有必要的资源。 在 UI status 页面中可以很好地跟踪此过程的进度。

通常,启动最多只需要 1 分钟。如果您觉得流程卡住了,请单击 Logs 按钮检查 operator 日志。如果日志看起来没问题,但 UI 似乎卡住了,请检查您是否配置了与 operator 相同的集群名称标签。

operator:https://github.com/zalando/postgres-operator/blob/master/manifests/configmap.yaml#L13
集群名称标签:https://github.com/zalando/postgres-operator/blob/master/ui/manifests/deployment.yaml#L45

从顶部菜单的 Status 字段中,您还可以检索 operator 正在使用的每个 worker 的日志和队列。可以配置并发 worker 的数量。

配置:https://postgres-operator.readthedocs.io/en/latest/reference/operator_parameters/#general

启动完成后,您将看到集群地址路径。启用负载均衡器后,列出的路径可用作连接 PostgreSQL 时的主机名。但是,请确保您的 IP 在指定的 allowedSourceRanges 范围内。

更新和删除集群

创建的集群列在 PostgreSQL clusters 菜单下。您可以通过 Status 按钮返回集群的 status 页面。从这两个菜单中,您可以选择编辑清单、克隆或删除集群。

克隆:https://postgres-operator.readthedocs.io/en/latest/user/#how-to-clone-an-existing-postgresql-cluster

请注意,UI 中尚不支持所有清单选项。 如果您尝试将它们添加到编辑器视图中,则不会产生效果。请改用 kubectl 命令。 左侧显示的清单也将显示以这种方式修补的参数。

清单选项:https://postgres-operator.readthedocs.io/en/latest/reference/cluster_manifest/

删除集群时,系统会要求您输入其命名空间名称以确认操作。

更多

基础设施代码(IAC),Zalando Postgres Operator 简介
Zalando Postgres Operator 快速上手

基础设施即代码(IAC),Zalando Postgres Operator UI 入门的相关教程结束。

《基础设施即代码(IAC),Zalando Postgres Operator UI 入门.doc》

下载本文的Word格式文档,以方便收藏与打印。