Job 无法访问特定域名
如果Gitlab Runner 通过Helm chart 部署到K8S 中,但出现无法访问特定域名的情况,则可以通过修改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 需要调度到指定节点
如果希望GitLab Runner 不影响其他业务,可以通过给节点打标签,然后指定节点调度即可:
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"