bazron
bazron

Reputation: 196

Gitlab-CI: How do I run a job on a specific server?

I set up Gitlab and Gitlab-CI on a k8s cluster in AWS. I have jobs that use a lot of resources. I want to run these jobs on specific instances in AWS. How can this be done?

Upvotes: 0

Views: 1963

Answers (1)

Nicolas Pepinster
Nicolas Pepinster

Reputation: 6191

Kubernetes configuration

You need to add a node selector which enable you to assign pods on specific nodes

kubectl label nodes <node-name> gitlab=true

Gitlab Runner configuration

  • Specify a tag associated to the runner. In your case, uncheck the Run untagged jobs option.
  • Specify a node selector using the keyword node_selector :
  [runners.kubernetes.node_selector]
    gitlab = "true"

Check a more complete example of config.toml on gitlab website.

Gitlab CI configuration

Refer the tag of your runner in your .gitlab-ci.yml

job:
  tags:
    - big_server

Upvotes: 2

Related Questions