LoginSignup
0
0
お題は不問!Qiita Engineer Festa 2023で記事投稿!

AKS + helm + gitlab + gitlabrunner でのエラーと解決策

Posted at

AKS上に、helm2を使用して、gitlab + gitlab runnerを構築した際に、詰まったことを記載する。

  • 環境
    • AKS v1.24
      • Kubernetes RBAC ture
    • helm v2.17.0
    • gitlab v不明
    • gitlab runner v16.0.2

問題1

 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を実行する際に、適切な権限が付与されたサービスアカウント名を指定して実行する必要がある。

参考URL

コマンド例

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に接続しに行くところで落ちていると思われる。
hostの接続先をvalue.yamlにて指定することで解消可能と思われる。が、未確認です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0