Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-74801

Unable to define hostAliases on pod-template

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • kubernetes-plugin
    • None

      Not sure if this is a bug or just me being to blind to see...

      On Pod templates UI I'm using the Raw YAML field with the idea of making a hosts entry within the containers:

      apiVersion: v1
      kind: Pod
      spec:
        hostAliases:
        - ip: "127.0.0.1"
          hostnames:
          - "foo.local" 

      ..but this only seems to work when Yaml merge strategy is set to Override.

      As we've defined quite a lot of Pod templates also inheriting from each other Override is not an option.

      I've also tried to workaround by directly modifying /etc/hosts via the container's entrypoint with the help of the Command to run field like this:

      /bin/sh -c "echo 127.0.0.1 foo.local" >> /etc/hosts"

      ...unfortunately that also doesn't work as /etc/hosts is managed by Kubernetes and above made entry gets reverted.

      Any help is highly appreciated.

      Thanks,
      Chris

            Unassigned Unassigned
            c13i Christian
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: