Kubernetes plugin ( want to run slave as pod )

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Kubernetes plugin ( want to run slave as pod )

Vamsi krishna
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

# NodeJS (from https://github.com/nodejs/docker-node/blob/12ba2e5432cd50037b6c0cf53464b5063b028227/8.1/Dockerfile)
# gpg keys listed at https://github.com/nodejs/node#release-team
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 \
  && curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
  && curl -SLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
  && 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. 

--
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 [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: Kubernetes plugin ( want to run slave as pod )

Carlos Sanchez
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



On Thu, Dec 28, 2017 at 6:51 PM, Vamsi krishna <[hidden email]> wrote:
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. 

--
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 [hidden email].
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.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CALHFn6N0Y0iCwKniof%2BpSzEq9HMF0TbgqO_Lx9WWt%3DNE5ko2Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Kubernetes plugin ( want to run slave as pod )

Vamsi krishna


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 <a href="https://github.com/kubernetes/kubernetes/issues/45911" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fkubernetes%2Fkubernetes%2Fissues%2F45911\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFTKBvPhkxl6kUSITSQchytV2bGrw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fkubernetes%2Fkubernetes%2Fissues%2F45911\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFTKBvPhkxl6kUSITSQchytV2bGrw&#39;;return true;">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?? 

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ad262af9-5a79-444c-86f6-6a2ae5a7f2fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Kubernetes plugin ( want to run slave as pod )

Vamsi krishna
In reply to this post by Carlos Sanchez
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




--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/211cba9b-abd9-4168-8f64-4787b5438991%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Kubernetes plugin ( want to run slave as pod )

Carlos Sanchez
In reply to this post by Vamsi krishna
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.


On Tue, Jan 2, 2018 at 8:29 PM, Vamsi krishna <[hidden email]> wrote:


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?? 

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ad262af9-5a79-444c-86f6-6a2ae5a7f2fe%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CALHFn6MXnJ3ifm-gO%2B7vvCmePGs7pgFnH_sYycAv7nnDDqxyPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.