我有一个使用 kubeadm 创建的 8s 集群(服务器版本:v1.25.4)。 正在运行Gitlab v15.11.13,它是与helm gitlab Chart v6.11.13一起安装的。
一切正常,但我想升级到下一个版本:v16.0.0。所以我运行这些命令:
helm get values gitlab -n gitlab > gitlab-values.yaml
kubectl scale deployment --replicas 0 --selector 'app in (webservice, sidekiq, kas, gitlab-exporter)' --namespace gitlab
# The documentation says to remove redis statefulset before this upgrade
kubectl delete statefulset gitlab-redis-master --namespace gitlab
# I use the values pulled a minute ago without any changes
helm upgrade gitlab gitlab/gitlab -n gitlab --version 7.0.0 --values gitlab-values.yaml
但是,升级失败并出现错误
禁止:禁止更新“replicas”、“template”、“updateStrategy”、“persistentVolumeClaimRetentionPolicy”和“minReadySeconds”以外的字段的 statefulset 规范
我没有时间修复它,所以决定重新部署图表 6.11.13,它在过去工作得很好:
helm upgrade gitlab gitlab/gitlab -n gitlab --version 6.11.13 --values gitlab-values.yaml
但是,这也行不通。 Pod
webservice
和 sidekiq
的状态为“Init:2/3”。这些容器的日志显示相同的错误:
kubectl logs -n gitlab -c dependencies -f gitlab-sidekiq-all-in-1-v2-7bdc4ddd8c-gfmn8
Begin parsing .erb templates from /var/opt/gitlab/templates
Writing /srv/gitlab/config/cable.yml
Writing /srv/gitlab/config/database.yml
Writing /srv/gitlab/config/gitlab.yml
Writing /srv/gitlab/config/resque.yml
Begin parsing .tpl templates from /var/opt/gitlab/templates
Copying other config files found in /var/opt/gitlab/templates to /srv/gitlab/config
Copying smtp_settings.rb into /srv/gitlab/config
- FAILED connecting to 'redis://gitlab-redis-master.gitlab.svc:6379' from resque.yml, through gitlab-redis-master.gitlab.svc
ERROR: Error connecting to Redis on gitlab-redis-master.gitlab.svc:6379 (Redis::TimeoutError)
Checking: resque.yml, cable.yml
Error checking main: connection to server at "10.106.237.84", port 5432 failed: Connection timed out
Is the server running on that host and accepting TCP/IP connections?
Checking: main
Sidekiq
和webservice
无法连接到redis
和postgres
,这很奇怪,因为这些服务看起来不错。我尝试将端口转发到 postgres
并且可以从我的笔记本电脑连接到数据库。
我尝试过
sidekiq
和 webservice
部署并重新启动 helm upgrade
。但没有任何帮助,现在日志发生了一点变化:没有 TIMEOUT 错误,因为
dependencies
容器提前一步被卡住了:Copying smtp_settings.rb into /srv/gitlab/config
。
所以,现在我发布了 gitlab 图表 v6.11.13,其值与之前完全相同,但不起作用,因为
webservice
和 sidekiq
停留在等待依赖关系的阶段。我没有看到任何错误。
不知道我还能在这里做什么。请帮忙
我找到了答案。恢复到以前的版本后,我发现 postgres 服务的选择器比需要的多:
postgres 服务:
apiVersion: v1
kind: Service
spec:
selector:
app: postgresql
app.kubernetes.io/component: primary
app.kubernetes.io/instance: gitlab
app.kubernetes.io/name: postgresql
release: gitlab
role: master
虽然有状态集具有:
apiVersion: apps/v1
kind: StatefulSet
spec:
template:
metadata:
labels:
app: postgresql
chart: postgresql-8.9.4
heritage: Helm
release: gitlab
role: master
所以,我删除了
app.kubernetes.io/component: primary
app.kubernetes.io/instance: gitlab
app.kubernetes.io/name: postgresql
一切都开始运转了。