I have a kubernetes cluster set up that is running Jenkins. I have a service that has ports 8080 and 50000 open (for jnlp). I also have an ingress controller configured that uses letsencrypt to sign https traffic.
A while ago (before having letsencrypt configured for my nginx controller), I had the full set up for the Kubernetes plugin in Jenkins. The main UI was through the Jenkins controller, but any build triggered would create a new pod that had a jnlp container and a build container, and it worked.
However, after adding in the TLS, I redeployed my Jenkins app, set up the kubernetes plugin, but have run into a really...odd error. Now, my jenkinsagent pods are cycling over and over with the following error:
PM WARNING hudson.plugins.gradle.injection.GradleBuildScanInjection inject Error: HOME is not set
Some more info: I am also specifically setting HOME through environment variables. Even testing a simple echo running on this node is failing
This causes an error down the track that the tcpSlaveListener returns a 404
....svc.cluster.local:8080/tcpSlaveAgentListener/ is invalid: 404 Not Found
Looking online, I cannot find the answer to this problem. I tried setting a HOME env variable in the jnlp agent, but that doesn't seem to work
CodePudding user response:
I was able to solve my issue, so I will post this as posteriety for other people facing this issue. I was using Jenkins in Kubernetes and the issue was in the Jenkins URL to communicate between Jenkins pods and the controller.
Initially I had Jenkins running in the top directory of my domain. This meant that setting my Jenkins URL with the format http://<service-name>.<namespace>.svc.cluster.local:8080
would work. However, I modified the deployment to include a prefix JAVA_OPTS value so my app would run under /jenkins
. Unbeknownst to me, this then required me to reset my Jenkins URL to communicate there: http://<service-name>.<namespace>.svc.cluster.local:8080/jenkins
. Initially it didn't make sense, as I thought that this should communicate through the service pod only, and I set my path through the ingress. After thinking about it more it does actually hold, as it is replacing the domain with the internal service URL, so it should reflect any prefix changes as well, thus svc.cluster.local:8080/tcpSlaveAgentListener/
was invalid, it should have been svc.cluster.local:8080/jenkins/tcpSlaveAgentListener/
Though I still have "HOME is not set", it does not seem to be related to my error.