I have deployed current version https://github.com/helm/charts/tree/master/stable/jenkins in my cluser .
Question is - How do I add values to /etc/hosts for slave agent.
For Master I am able to achieve this using
- hostAliases
Which is working fine.
But not able to figure it out for slave agent. (Currently I am using -
image: "jenkins/jnlp-slave"
tag: "3.27-1"
The problem is slave agent is not able to connect to github and artifactory. I Need a way to updates values in /etc/hosts or do we have any other approach?
Try specify custom yaml in podTemplate() https://www.jenkins.io/doc/pipeline/steps/kubernetes/#podtemplate-define-a-podtemplate-to-use-in-the-kubernetes-plugin like this:
podTemplate(label: nodeLabel,
yaml: """
spec:
hostAliases:
- ip: "your_ip_address"
hostnames:
- "my.hostname.com"
- "another.host.com"
""",
containers: ...,
volumes: ...) { }
It works well for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With