maximum memory usage error when using services in a kubernetes executor
I have been struggling to set up a gitlab-runner instance in an OpenShift cluster in my organisation of my project (I am not the admin of the OS, I am only a developer using the platform).
So up to now,
- I have the gitlab-runner Pod running,
- The runner is registered to my gitlab project
- I can initiate CI jobs in this kubernetes executor
I am at a step where I need to use a mysql service to execute some test against some DB.
I did a couple of modifications in my pipeline a few days ago, to validate that the service is created, but since today, while doing almost the same things, or even less, whenever I specify a service section in my .gitlab-ci.yml file, the job fails almost instantly in the "prepare environment" step due to a memory issue:
Running with gitlab-runner 15.8.1 (f86890c6)
on gitlab-runner-runner-5946b87596-b9zmr Vrmy5iHW, system ID: r_ChIYH4qkfA8Z
Resolving secrets
Preparing the "kubernetes" executor
Using Kubernetes namespace: <MYNAMESPACE>
Using Kubernetes executor with image artifactory.my-organisation/docker/maven:3-jdk-8 ...
Using attach strategy to execute scripts...
Preparing environment
ERROR: Job failed (system failure): prepare environment: setting up build pod: pods "runner-vrmy5ihw-project-5661-concurrent-05rcm7" is forbidden: maximum memory usage per Pod is 8Gi, but limit is 9126805504. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
I would like to investigate but I don't know where all this memory calculation come from.
Could someone please give some advice or clue to investigate more ?
The config of my gitlab-runner is:
data:
config.toml: |
[[runners]]
[runners.kubernetes]
service_account = "gitlab-runner-sa"
service_account_overwrite_allowed = ".*"
memory_request = "256Mi"
memory_limit = "7.5Gi"
[[runners.kubernetes.volumes.pvc]]
name = "gitlab-runner-cache"
mount_path = "/home/gitlab-runner/cache"
my .gitlab-ci looks like:
variables:
GIT_DEPTH: 1
Test MySQL Service:
tags:
- openshift
stage: build
variables:
MYSQL_ROOT_PASSWORD: root
image: artifactory.my-organisation/docker/maven:3-jdk-8
services:
# - name: artifactory.my-organisation/docker/docker:dind
- name: artifactory.my-organisation/docker/mysql:5.7
alias: mysql
rules:
- if: $CI_COMMIT_BRANCH
script:
- echo "TESTING MYSQL"
- javac TestMySql.java
- ls -l | grep TestMySql
- java -cp ".:mysql-connector-java-8.0.30.jar" TestMySql
Thank you.