Skip to content

GitLab Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
gitlab-runner
gitlab-runner
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 1,996
    • Issues 1,996
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 204
    • Merge Requests 204
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • GitLab.org
  • gitlab-runnergitlab-runner
  • Issues
  • #2818

Closed (duplicated)
Open
Opened Oct 08, 2017 by Galen Liu@galen_liu

Support extra hosts for kubernetes with host alises

Description

The [runners.docker] section have extra_hosts option to configure hosts file.

https://gitlab.com/gitlab-org/gitlab-runner/blob/master/docs/configuration/advanced-configuration.md#the-runnersdocker-section extra_hosts specify hosts that should be defined in a container environment

kubernets has HostAliases to do same thing:

https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/

  hostAliases:
  - ip: "127.0.0.1"
    hostnames:
    - "foo.local"
    - "bar.local"
  - ip: "10.1.2.3"
    hostnames:
    - "foo.remote"
    - "bar.remote"

I'm using /etc/hosts to resolve my gitlab host name, and encounter Couldn't resolve host 'gitlab.myhost.com'

Running with gitlab-runner 10.0.2 (a9a76a50)
  on Kubernetes Runner (e5d51f58)
Using Kubernetes namespace: gitlab
Using Kubernetes executor with image busybox:latest ...
Waiting for pod gitlab/runner-e5d51f58-project-87-concurrent-0ctv75 to be running, status is Pending
Waiting for pod gitlab/runner-e5d51f58-project-87-concurrent-0ctv75 to be running, status is Pending
Running on runner-e5d51f58-project-87-concurrent-0ctv75 via gitlab-runner-5d678545dc-wv9n2...
Cloning repository...
Cloning into '/docker/gitlab-runner'...
fatal: unable to access 'https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@gitlab.myhost.com/docker/gitlab-runner.git/': Couldn't resolve host 'gitlab.myhost.com'
ERROR: Job failed: error executing remote command: command terminated with non-zero exit code: Error executing in Docker Container: 1

Proposal

Links to related issues and merge requests / references

Please paste a link of the related issues or/and merge requests

Edited Jan 02, 2020 by Steve Azzopardi
Assignee
Assign to
13.7
Milestone
13.7 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: gitlab-org/gitlab-runner#2818