Add own hostnames

Hi, i want to use an intern docker registry and add the host in /etc/hosts but it doesn’t work.

I tried it with:

      lifecycle:
        postStart:
          exec:
            command: ["/bin/sh", "-c", "cat /etc/hosts >> /etc/hosts"]

and

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

in image-builder-deployment, but it doesn’t add the hostnames…

I tried it under deployment.spec, deployment.template.spec and deployment.template.spec.containers. but nothing worked.

Ok, i can close this already. I edited the running deployment and added hostAliases to deployment.spec.template.spec and it restarted the pods immediatly and added the hostname.

1 Like