Kubernetes Executor with Proxy Settings

8/2/2021

I am using the helm chart for gitlab runner in a Kubernetes Cluster and need to pass environment variables to my Kubernetes Runner to allow him to download for example content from s3 cache. Unfortunately it does not work. Anyone any solutions for me ?

my values.yaml:

gitlabUrl: https://example.com
image: default-docker/gitlab-runner:alpine-v14.0.1

runnerRegistrationToken: XXXXXXXXXXXXX

imagePullPolicy: IfNotPresent

imagePullSecrets:
  - name: "k8runner-secret"

rbac:
  create: true

runners:
  config: |
    [[runners]]
      environment = ["http_proxy: http://webproxy.comp.db.de:8080", "https_proxy: http://webproxy:comp:db:de:8080", "no_proxy: \"localhost\""]
      [runners.kubernetes]
        image = "default-docker/ubuntu:16.04"
        cpu_request = "500m"
        memory_request = "1Gi"
        namespace = "gitlab"
      [runners.cache]
        Type = "s3"
        Path = "cachepath"
        Shared = true
        [runners.cache.s3]
          ServerAddress = "s3.amazonaws.com"
          BucketName = "exampleBucket"
          BucketLocation = "eu-west-1"
          Insecure = false
  tags: "test"
  locked: true
  name: "k8s-runner"

resources:
  limits:
    memory: 1Gi
    cpu: 500m
  requests:
    memory: 250m
    cpu: 50m


ENVIRONMENT:
  http_proxy: http://webproxy.comp.db.de:8080
  https_proxy: http://webproxy:comp:db:de:8080
  no_proxy: "localhost"

config.template.toml located on the pod:

[[runners]]
  [runners.kubernetes]
    image = "default-docker/ubuntu:16.04"
    cpu_request = "500m"
    memory_request = "1Gi"
    namespace = "gitlab"
  [runners.cache]
    Type = "s3"
    Path = "cachepath"
    Shared = true
    [runners.cache.s3]
      ServerAddress = "s3.amazonaws.com"
      BucketName = "exampleBucket"
      BucketLocation = "eu-west-1"
      Insecure = false

config.toml located on the pod:

concurrent = 10
check_interval = 30
log_level = "info"
listen_address = ':9252'

It looks for me that he is not adding the environment variables. If I enter the env cmd I also can't find the environment variables.

I am thankful for every helping hand

-- ve05ribu
gitlab-ci-runner
kubernetes
kubernetes-helm
kubernetes-pod

0 Answers