Issue
- I want to change the URL that kubernetes agents are using to connect to Jenkins
Environment
- CloudBees CI (CloudBees Core) on modern cloud platforms - Managed Master
- CloudBees CI (CloudBees Core) on modern cloud platforms - Operations Center
- CloudBees CI (CloudBees Core) on traditional platforms - Client Master
- CloudBees CI (CloudBees Core) on traditional platforms - Operations Center
- CloudBees Jenkins Team
- CloudBees Jenkins Platform - Client Master
- CloudBees Jenkins Platform - Operations Center
- Jenkins LTS
- Kubernetes Plugin
Resolution
The Kubernetes Plugin passes the Jenkins URL to the jnlp
container in agent pods as an environment variable and the agent process connects to Jenkins using the script: https://github.com/jenkinsci/docker-jnlp-slave/blob/master/jenkins-slave.
By default, the Jenkins URL configured under manage Manage Jenkins > Configure System is used. In most cases, this is acceptable. But in some cases it is required that agents connect to a different endpoint, for example to connect through a specific proxy load balancer or via internal IP / hostnames.
The Kubernetes Plugin resolves the Jenkins URL from different sources in that order:
- The “Jenkins URL” configured for the Kubernetes Cloud under Manage Jenkins > Configure System > Cloud
- If empty or not specified, the value of the System Property
KUBERNETES_JENKINS_URL
(i.e. passing-DKUBERNETES_JENKINS_URL
to the Jenkins’s startup) - If empty or not specified, the value of the Environment Variable
KUBERNETES_JENKINS_URL
- If empty or not specified, the “Jenkins URL” configured under Manage Jenkins > Configure System
0 Comments