GitLab 流水線常見問題集錦

Job 無(wú)法訪問特定域名

如果Gitlab Runner 通過(guò)Helm chart 部署到K8S 中,但出現(xiàn)無(wú)法訪問特定域名的情況,則可以通過(guò)修改runners 配置,添加[[runners.kubernetes.host_aliases]] 配置即可:

[[runners]]
  # usual configuration
  executor = "kubernetes"
  [runners.kubernetes]
    [[runners.kubernetes.host_aliases]]
      ip = "127.0.0.1"
      hostnames = ["web1", "web2"]
    [[runners.kubernetes.host_aliases]]
      ip = "192.168.1.1"
      hostnames = ["web14", "web15"]

詳情可參考:https://docs.gitlab.com/runner/executors/kubernetes.html#other-configtoml-settings

GitLab Runner 需要調(diào)度到指定節(jié)點(diǎn)

如果希望GitLab Runner 不影響其他業(yè)務(wù),可以通過(guò)給節(jié)點(diǎn)打標(biāo)簽,然后指定節(jié)點(diǎn)調(diào)度即可:

runners:
  # runner configuration, where the multi line strings is evaluated as
  # template so you can specify helm values inside of it.
  #
  # tpl: https://helm.sh/docs/howto/charts_tips_and_tricks/#using-the-tpl-function
  # runner configuration: https://docs.gitlab.com/runner/configuration/advanced-configuration.html
  config: |
    [[runners]]
      [runners.kubernetes]
        namespace = "{{.Release.Namespace}}"
        [[runners.kubernetes.host_aliases]]
          ip = "10.1.3.215"
          hostnames = ["abcaf2.ccs.tencent-cloud.com"]
      [runners.kubernetes.node_selector]
        gitlab = "true"
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容