AKS + helm + gitlab + gitlabrunner 在遇到问题时的解决方案

使用AKS在構建gitlab + gitlab runner時,遇到了一些阻礙。

    • 環境

AKS v1.24

Kubernetes RBAC ture

helm v2.17.0
gitlab v不明
gitlab runner v16.0.2

第一个问题

 helm init

在执行完后,helm list和helm install出现错误。
※ 除了helm list和helm install之外,所有尝试从tiller访问AKS的命令都会出现相同的错误。

执行示例

$ helm install --name gitlab-shared-runner gitlab/gitlab-runner --set gitlabUrl=https://gitlab.example.com:32443/ --set privileged=true --set runnerRegistrationToken=xxxxxxxxxxxxxxx
Error: release gitlab-shared-runner failed: namespaces "default" is forbidden: User "system:serviceaccount:kube-system:default" cannot get resource "namespaces" in API group "" in the namespace "default"

解决方案

tillerの権限不足が原因で、エラーが出ている。
helm initを実行する際に、適切な権限が付与されたサービスアカウント名を指定して実行する必要がある。

请提供参考网址。

 

命令示例

helm init --service-account helm

請問問題2可以用中文解釋嗎?

尽管已部署了GitLab Runner,但无论执行多少次CI,“pending”状态的Job仍然不会开始运行。
尽管已注册了Runner,但在CI中却显示“没有可用的Runner可以执行”。

解决方案

AKSやgitlabの設定の問題ではなく、gitlab runner の helm Chartが誤っている可能性が高い。
value.yamlを最小構成で実行し直してみるなど、Chartの修正を行ってみるのが良い。

问题3

在GitLab上执行CICD时,连接大约30秒后出现错误。

Running with gitlab-runner 16.0.2 
  on kubernetes-runner
Preparing the "kubernetes" executor
Using Kubernetes namespace: gitlab-runner
Using Kubernetes executor with image ubuntu:16.04 ...
Using attach strategy to execute scripts...
Preparing environment
ERROR: Job failed (system failure): prepare environment: setting up credentials: Post "https://172.30.0.1:443/api/v1/namespaces/default/secrets" dial tcp 172.30.0.1:443: i/o timeout. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information

您有什麼解決方法?

似乎在尝试将GitLab Runner连接到Kubernetes API时出现错误。可以通过在value.yaml文件中指定主机连接来解决此问题。但是,还没有确认过。

广告
将在 10 秒后关闭
bannerAds