我想实现的目标
嗨,我目前正在尝试通过 gitlab CI 作业部署 postgresql-ha(更具体地说是 bitnami/postgresql-ha(helm chart。
我可以在本地实现什么
在本地,当运行helm install postgresql ./postgresql-ha
时,我能够在远程 Kubernetes 集群上成功创建图表,而不会出现任何错误。
./postgresql-ha
是未经修改的bitnami/postgresql-ha
拉动。
当我通过 CI 运行它时会发生什么
当我尝试在 Gitlab 的 CI 中运行相同的命令时,使用正确设置的helm
和kubectl
,出现此错误:
Release "postgresql" does not exist. Installing it now.
Error: template: postgresql-ha/templates/NOTES.txt:60:4: executing "postgresql-ha/templates/NOTES.txt" at <include "postgresql-ha.validateValues" .>: error calling include: template: postgresql-ha/templates/_helpers.tpl:682:51: executing "postgresql-ha.validateValues" at <fail>: error calling fail:
VALUES VALIDATION:
postgresql-ha: Nodes hostnames
PostgreSQL nodes hostnames exceeds the characters limit for Pgpool: 128.
Consider using a shorter release name or namespace.
第一行验证kubectl/helm配置。
.gitlab-ci.yml文件
##########
# Stages #
##########
stages:
- deploy charts
########
# Jobs #
########
deploy_postgresql-ha:
image: dtzar/helm-kubectl:3.0.0
stage: deploy charts
environment:
name: production
script:
- helm upgrade --install postgresql ./postgresql-ha
Kubernetes 集群是通过 Gitlab的 Kubernetes Integration 工具创建的,因此已经按照这个 Gitlab 文档页面进行了设置。
提前感谢您的帮助!
pgpool上似乎有一个错误:
由于缓冲区较小,ping 探测器因长主机名而失败 pgpool调用"ping -q -c3"并解析结果以确定主机是启动还是关闭。不幸的是,它使用一个相当小的缓冲区来读取输出,并且ping命令的最后一行可能会被截断。 这意味着 pgpool 假定主机已关闭。
https://pgpool.net/mantisbt/print_all_bug_page_word.php?search=&sort=&dir=DESC&type_page=html&export=-1&show_flag=0
Bitnami 升级了代码,因此现在不再允许使用长主机名。节点主机名由以下组件组成,因此您可以进行调整:
$nodeHostname := printf "%s-00.%s.%s.svc.%s:1234" $postgresqlFullname $postgresqlHeadlessServiceName $releaseNamespace $clusterDomain }}
https://github.com/bitnami/charts/blob/master/bitnami/postgresql-ha/templates/_helpers.tpl