Mongo service is unavailable when the kubernetes runner executes the test job

Summary

Our CI runs tests using the mongo service and this works fine on the shared runners. I recently installed the GitLAB runner helm chart and added a group runner. Whenever the job is executed by this runner the test fail.

The error is: MongoNetworkError: failed to connect to server [mongo:27017] on first connect [MongoNetworkError: getaddrinfo EAI_AGAIN mongo mongo:27017]

Steps to reproduce

Use the mongo service on a non-shared Kubernetes runner

What is the current bug behavior?

MongoNetworkError: failed to connect to server [mongo:27017] on first connect [MongoNetworkError: getaddrinfo EAI_AGAIN mongo mongo:27017]

What is the expected correct behavior?

Connect to MongoDB correctly

Output of checks

This bug happens on GitLab.com but with our own runner on an Azure Kubernetes cluster

Assignee Loading
Time tracking Loading