極狐GitLab Runner 升級指南!

极狐GitLab發表於2024-09-13

本分分享如何對 Helm 安裝的 Runner 進行升級。整個過程分為三步:1、確定 Runner 最新版本或者想要升級的版本是否存在;2、用 Helm upgrade 命令進行升級;3、升級確認。

極狐GitLab 為 GitLab 的中國發行版,中文版本對中國使用者更友好,可以一鍵私有化部署,安裝升級詳情可以檢視官網

前提

  • 用 Helm 安裝且執行正常的 Runner

關於使用 Helm 進行極狐GitLab Runner,可以參考文章如何用 Helm 安裝特定版本的 GitLab Runner?,然後檢視 Runner 的版本和執行狀況:

# 檢視 Helm Release 以及 Runner 的版本
helm ls --namespace jh-gitlab-runner
NAME                NAMESPACE           REVISION    UPDATED                                    STATUS      CHART                   APP VERSION
jh-gitlab-runner    jh-gitlab-runner    1           2024-09-11 06:50:17.139514892 +0000 UTC    deployed    gitlab-runner-0.68.0    17.3.0

# 檢視 Runner 的執行狀態
kubectl -n jh-gitlab-runner get pods
NAME                                              READY   STATUS    RESTARTS   AGE
jh-gitlab-runner-gitlab-runner-5c558fb88b-lnfxm   1/1     Running   0          42h

查詢 Runner 版本

升級的前提是確定想要升級到哪個版本,使用 Helm 安裝的話,可以用 helm search命令來查詢版本:

# 查詢 Repo
helm repo list
NAME         URL
jh-gitlab    https://charts.gitlab.cn

# 查詢最近的 5 個版本
helm search repo jh-gitlab/gitlab-runner -l | head -5
NAME                       CHART VERSION    APP VERSION    DESCRIPTION
jh-gitlab/gitlab-runner    0.68.1           17.3.1         GitLab Runner
jh-gitlab/gitlab-runner    0.68.0           17.3.0         GitLab Runner
jh-gitlab/gitlab-runner    0.67.0           17.2.0         GitLab Runner
jh-gitlab/gitlab-runner    0.66.0           17.1.0         GitLab Runner

可以看到最新的版本是 17.3.1,而當前安裝的是 17.3.0。接下來就準備升級到 17.3.1

Runner 的升級

執行 helm upgrade即可完成升級,升級過程中可以使用 --version執行想要升級的版本

helm upgrade --namespace jh-gitlab-runner -f values.yaml jh-gitlab-runner jh-gitlab/gitlab-runner --version 0.68.1
W0913 01:41:09.427151  715889 warnings.go:70] unknown field "spec.template.spec.containers[0].securityContext.fsGroup"
Release "jh-gitlab-runner" has been upgraded. Happy Helming!
NAME: jh-gitlab-runner
LAST DEPLOYED: Fri Sep 13 01:41:08 2024
NAMESPACE: jh-gitlab-runner
STATUS: deployed
REVISION: 2
TEST SUITE: None
NOTES:
Your GitLab Runner should now be registered against the GitLab instance reachable at: "http://jhma.jihulab.net"

Runner namespace "jh-gitlab-runner" was found in runners.config template.

#############################################################################################
## WARNING: You enabled `rbac` without specifying if a service account should be created.  ##
## Please set `serviceAccount.create` to either `true` or `false`.                         ##
## For backwards compatibility a service account will be created.                          ##
#############################################################################################

可以看到 Runner pod 的狀態變化

kubectl -n jh-gitlab-runner get pods -w
NAME                                              READY   STATUS    RESTARTS   AGE
jh-gitlab-runner-gitlab-runner-5c558fb88b-lnfxm   1/1     Running   0          42h
jh-gitlab-runner-gitlab-runner-b444666d-fn7l9     0/1     Running   0          26s
jh-gitlab-runner-gitlab-runner-b444666d-fn7l9     1/1     Running   0          70s
jh-gitlab-runner-gitlab-runner-5c558fb88b-lnfxm   1/1     Terminating   0          42h 

Runner 升級確認

用 helm ls確認 Runner 的版本資訊

helm ls --namespace jh-gitlab-runner
NAME                NAMESPACE           REVISION    UPDATED                                    STATUS      CHART                   APP VERSION
jh-gitlab-runner    jh-gitlab-runner    2           2024-09-13 01:41:08.757879746 +0000 UTC    deployed    gitlab-runner-0.68.1    17.3.1

可以看到版本從 17.3.0 升級到了 17.3.1。可以在 Runner 管理介面再次確認

file

在介面上同樣可以看到 Runner 到了 17.3.1

相關文章