Kubernetes plugin ( want to run slave as pod )

362 views
Skip to first unread message

Vamsi krishna

unread,
Dec 28, 2017, 4:17:56 PM12/28/17
to Jenkins Users
Hello Team,

I am using kubernetes plugin 1.1 
My cluster is running in local Host.. Jenkins is running in outside cluster..
I want to run my Jenkins build jobs with slave pod in containers..after build job is done my slave pod has to kill automatically..
Pod is killing automatically when build job is done..but issue is 
My job is running on jenkins/jnlp-slave image not in my base image.for that I mentioned jnlp as my container name then job is not able to run showing pending slave-td45h is offline.

How to connect my container to  talk to the Jenkins. I am trying for the freestyle jobs.

I created image with making baseimage of  in my dockerfike i mentioned FROM Jenkins/jnlp-slave is it right to use like this..
If u want I will show my total dockerfile..

From jenkins/jnlp-slave
USER root

ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 8.9.0
ENV COMPOSE_VERSION 1.12.0

RUN set -ex \
  && for key in \
    94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
    FD3A5288F042B6850C66B31F09FE44734EB7990E \
    71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
    DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
    C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
    B9AE9905FFD7803F25714661B63B535A4C206CA9 \
    56730D5401028683275BD23C23EFEFE93C4CFFFE \
    77984A986EBC2AA786BC0F66B01FBB92821C587A \
  ; do \
    gpg --keyserver pgp.mit.edu --recv-keys "$key" || \
    gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \
    gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \
  done


RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
  && case "${dpkgArch##*-}" in \
    amd64) ARCH='x64';; \
    ppc64el) ARCH='ppc64le';; \
    s390x) ARCH='s390x';; \
    arm64) ARCH='arm64';; \
    armhf) ARCH='armv7l';; \
    *) echo "unsupported architecture"; exit 1 ;; \
  esac \
  && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
  && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
  && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 \
  && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \
  && ln -s /usr/local/bin/node /usr/local/bin/nodejs

RUN apt-get update && apt-get install -y git jq rsync g++ build-essential && apt-get clean

ADD jenkins-slave /usr/local/bin

USER jenkins 

using this image my container is not running properly getting logs as failed to open log file "/var/log/pods/70d9def9-ebf7-11e7-867e-005056bf5570/jnlp_0.log": open /var/log/pods/70d9def9-ebf7-11e7-867e-005056bf5570/jnlp_0.log: no such file or directory
these are the logs  i am getting any idea... if this container runs succesfully then i can run my jenkins job in this container. because i did base image as jenkins/jnlp-slave.   Can anyone please help me.. I have this issue since week. 

Carlos Sanchez

unread,
Dec 30, 2017, 1:29:58 PM12/30/17
to Jenkins Users
what logs and events are you getting when you run

* kubectl logs your_pod_slave
* kubectl describe your_pod_slave

are you getting "failed to open log file" there? if you do it looks like a kubernetes issue, like https://github.com/kubernetes/kubernetes/issues/45911 that points to your container running out of memory



--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c1d734a7-d4f7-444b-8689-81ab3929384b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vamsi krishna

unread,
Jan 2, 2018, 2:29:07 PM1/2/18
to Jenkins Users


On Saturday, December 30, 2017 at 10:29:58 AM UTC-8, Carlos Sanchez wrote:
what logs and events are you getting when you run

* kubectl logs your_pod_slave
* kubectl describe your_pod_slave

are you getting "failed to open log file" there? if you do it looks like a kubernetes issue, like https://github.com/kubernetes/kubernetes/issues/45911 that points to your container running out of memory


my pod is runnning fine in kubernetes....  but jenkins not able to take that  container to run the job.. is this issue with backend service.. i mean when pod is running succesfull then kubernetes assigns the pod to jenkins to run the job its concept wise. but my issue is, in that pod jenkins not able to run the job..  
pods logs showing nothing.... my reverse jnlp slave port should be 50000 or i can put any fixed port number?? 

Vamsi krishna

unread,
Jan 3, 2018, 1:03:21 PM1/3/18
to Jenkins Users
Hi @carlos 

in jenkins kubernetes plugin configuration we need to mention in the container template
Working directory /home/jenkins
command to run slave agent  ? 
arguments to pass to the command ${computer.jnlpmac}  ${computer.name

is this correrct what i am given????  and what is that command to run slave agent what i need to given at there  default i am getting /bin/bash -c is it correct or i need to change




Carlos Sanchez

unread,
Jan 4, 2018, 1:30:12 PM1/4/18
to Jenkins Users
kubectl logs your_pod_slave has to print something, with that we could probably help you better

Please stop hijacking jira issues and other email threads to enter unrelated comments.


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages