Jenkins has several methods of running and connecting to agents. The fact 
that Jenkins master is running in a Kubernetes cluster doesn't limit how it 
connects to agents. For example, you can use the SSH slaves plugin to 
connect to any machine running SSH and visible to the Jenkins master. 
https://plugins.jenkins.io/ssh-slaves

On Sunday, January 26, 2020 at 11:38:43 PM UTC-5, touseef wrote:
>
> Thanks for the reply .It would work fine if the master and the nodes are 
> on the same cluster under the same network.
> However my use case is my nodes can be in different network and it will 
> not work with kubernetes.
> is there any other way without using kubernets perhaps
>
> On Monday, 20 January 2020 22:07:31 UTC+5:30, Andrey Babushkin wrote:
>>
>>
>> Hi,
>> As far as I understood you're using Jenkins Kubernetes plugin and you 
>> have your own Kubernetes cluster with a few physical nodes connected to it.
>> In that case you should label your Kubernetes nodes like this (assuming 
>> you have working kubectl setup):
>> kubectl label node node1.example.com hw_type=type1
>>
>> kubectl label node node2.example.com hw_type=type2
>>
>> Then you should specify label you need in podTemplate section of your 
>> Jenkins pipeline (I slightly changed code from examples folder in 
>> Kubernetes plugin repo - 
>> https://github.com/jenkinsci/kubernetes-plugin/blob/master/examples/maven.groovy
>> )
>>
>> podTemplate(nodeSelector: 'hw_type=type1', containers: [
>>     containerTemplate(name: 'maven', image: 'maven:3.3.9-jdk-8-alpine',
>>                       ttyEnabled: true, command: 'cat',
>>
>>     )
>>   ]) {
>>
>>   node(POD_LABEL) {
>>     stage('Tests on hardware type 1') {
>>       git 'https://github.com/jenkinsci/kubernetes-plugin.git'
>>       container('maven') {
>>           sh 'mvn -B clean package'
>>       }
>>     }
>>   }
>> }
>>
>>
>> On Monday, January 20, 2020 at 9:19:00 AM UTC+3, touseef wrote:
>>>
>>> Can anyone point me in right direction,
>>>
>>> I have a use case as follow:
>>>
>>> Kubernetes master running the jenkins and i have n number of physical 
>>> machine connected with different hardwares,So what i want to achieve is 
>>> when a specific job is triggered in jenkins to execute a test on hardware , 
>>> k8's(kubernetes master) should route and connect to that machine in a pool 
>>> which has requiste hardware and execute the tests.
>>>
>>> Any pointer how to achieve is appreciated
>>>
>>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/0ba6e415-3985-470e-b2e5-e77cb3e13f2b%40googlegroups.com.

Reply via email to