Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kubernetes slaves cannot register to jenkins master

I have a kubernetes cluster (hosted at the university, not in gcloud) and I'm trying to use Jenkins with the jenksci/kubernetes plugin to launch the slaves. However, it seems they cannot register to the master, no matter what I do. (k8s 1.2, jenkins 2.19.2, kub-plugin 0.9)

This is the configuration I use:

This is the configuration I use Now:

  • If I set tty:true the container starts but is never able to connect to the master. The logs are unreadable and I cannot attach to the slave to inspect what is happening:

    $ kubectl logs jnpl-slave-ec16b9ae7bbd --namespace=jenkins
    Error from server: Unrecognized input header
    $ kubectl attach -ti jnpl-slave-ec16b9ae7bbd --namespace=jenkins 
    error: pod jnpl-slave-ec16b9ae7bbd is not running and cannot be attached to; current phase is Succeeded
    
  • If I set tty:false the container starts and correctly executes the entrypoint /usr/local/bin/jenkins-slave, but it seems that the secret and the slaveName command-line args are not passed, as the process dies asking for them:

    $ kubectl logs jnpl-slave-ecfd3a6cbaba --namespace=jenkins
    Warning: JnlpProtocol3 is disabled by default, use JNLP_PROTOCOL_OPTS to alter the behavior
    two arguments required, but got []
    ...
    
  • If I manually set the parameters (seed and the slave name) to a fake value, it starts correctly, but then dies complaining that /home/jenkins is not writable:

    Warning: JnlpProtocol3 is disabled by default, use JNLP_PROTOCOL_OPTS to alter the behavior
    hudson.remoting.jnlp.Main createEngine
    Setting up slave: http://10.254.151.87
    hudson.remoting.jnlp.Main$CuiListener <init>
    INFO: Jenkins agent is running in headless mode.
    Exception in thread "main" java.lang.RuntimeException: Root directory not writable
    ...
    
  • However, if I create a slave manually on the webpage setup it, it works and I can see the slave online:

    node$ sudo docker run -ti docker.io/jenkinsci/jnlp-slave:latest /bin/bash
    pod$ java -jar /usr/share/jenkins/slave.jar -jnlpUrl http://10.254.151.87/computer/slave1/slave-agent.jnlp
    ...
    INFO: Connected
    

So... I don't know what to test further. I would really appreciate if someone could give me an hint!

With best regards,

Mario

like image 355
Mario Ceresa Avatar asked Mar 11 '23 16:03

Mario Ceresa


1 Answers

The arguments field should be ${computer.jnlpmac} ${computer.name} and should be set by default when adding new containers to the Pod definition

like image 80
csanchez Avatar answered Mar 18 '23 10:03

csanchez