Jenkins - How to pick Kubernetes server to deploy to? - jenkins

I have installed the Kubernetes plugin as well as added 2 kubernetes slave nodes in the Jenkins -> Manage Jenkins -> Configure system -> Cloud.
Then when adding jobs I can't see a place to configure the target environment. There's simply no tabs as seen for example here:
Here's what it looks on my job configuration:

Related

Jenkins master and Slave installation on CI/CD pipeline

I am trying to implement CI/CD pipeline by using Kubernetes and Jenkins. I am planning to use Kubernetes HA Cluster having 3 master and 5 worker machine / node.
Now I am exploring about the implementation tutorials for CI/CD Pipeline. And also exploring about the Jenkins usage with Kubernetes HA Cluster. When I am reading , I felt little bit confusions about Jenkins. That I am adding here.
1. I have total 8 VMs - 3 Master and 5 Worker machines / nodes (Kubernetes cluster). If I installing Jenkins in any one worker machines , then is there any problem while integrating with CI/CD pipeline for deployment ?
2. I am previously readed the following link for understanding the implementations,
https://dzone.com/articles/easily-automate-your-cicd-pipeline-with-jenkins-he
Is this mandatory to use Jenkins master and slave ?. In this tutorial showing that If kubectl,helm and docker is installed then don't need to use Jenkins slave. What is the idea about master and slave here?
3. If I am installing both jenkins master and slave in kubernetes cluster worker machine / node , then Need to install master and slave in separate separate VMs? I have still confusion about where to install Jenkins?
I am just started on CI/CD pipeline - Kubernetes and Jenkins.
Jenkins has two parts. There's the master, which manages all the jobs, and the workers, which perform the jobs.
The Jenkins master supports many kinds of workers (slaves) via plugins - you can have stand alone nodes, Docker based slaves, Kubernetes scheduled Docker slaves, etc.
Where you run the Jenkins master doesn't really matter very much, what is important is how you configure it to run your jobs.
Since you are on Kubernetes, I would suggest checking out the Kubernetes plugin for Jenkins. When you configure the master to use this plugin, it will create a new Kubernetes pod for each job, and this pod will run the Docker based Jenkins slave image. The way this works is that the plugin watches for a job in the job queue, notices there isn't a slave to run it, starts the Jenkins slave docker image, which registers itself with the master, then it does the job, and gets deleted. So you do not need to directly create slave nodes in this setup.
When you are in a Kubernetes cluster in a container based workflow, you don't need to worry about where to run the containers, let Kubernetes figure that out for you. Just use Helm to launch the Jenkins master, then connect to the Jenkins master and configure it to use Kubernetes slaves.

Jenkins: Environment separation during executing Jenkins2 Declarative Pipeline

I have a Jenkins server running on a Virtual Machine and has 2 agents configured.
I am trying to execute the following stages using Jenkins Pipeline as a code in Continuous Delivery format.
Build -> Unit Test -> Containerize -> Deploy to Dev Kubernetes Cluster -> Carry out minimal testing -> Deploy to Staged Kubernetes Cluster -> Integration Tests -> Deploy to UAT
I have 2 microservices in using different repositories.
I have a scenario where My service 1 deploys kubernetes artifacts in Dev Kubernetes clusters and simultaneously my Service 2 deploys kubernetes artifacts on Staged cluster.
Can I isolate the contexts in anyways so that the kubernetes clusters information is not mixed between 2 pipelines?

Executors not starting with Jenkins on Google Container Engine

I want to try out continuous deployment with Jenkins on Google Container Engine.
I have gone through https://cloud.google.com/solutions/jenkins-on-container-engine-tutorial and then https://cloud.google.com/solutions/continuous-delivery-jenkins-container-engine.
I have done it all twice to make sure I didn't miss anything in the tutorials, but still I have the same problem. The problem is in the second tutorial, under the section "Creating a Jenkins job". I follow all the steps, but my build job never starts. All I get in Jenkins is Waiting for next available executor.
Do you have any ideas what is wrong?
Things started working once I added jnlp here:
Manage Jenkins -> Configure System -> Cloud -> Kubernetes -> Defaults Provider Template Name

How do I pass on my build file from Jenkins to Saltstack master

We have a Jenkins system to automate build from Github, now we are implementing a Saltstack system. So I need to integrate my Jenkins with Salt-master so that it passes all the new builds to the master which then sends it across the salt-clients(minions).
The saltstack setup is in AWS cloud and and the Jenkins machine is outside the cloud in a local setup.
You could enable the salt-api and using the following plugin: https://wiki.jenkins-ci.org/display/JENKINS/saltstack-plugin then all of your jenkins builds can execute states / orchestrations etc. to any minions on a per job basis.
Another way of doing this is to have a minion running on the salt-master and install the jenkins slave on the same box. Then restrict the jenkins jobs to that jenkins slave and execute the commands as if you were at the command line. NOTE: this option requires a bit more configuration.

Distributed Jenkins- Master on Linux and slave on windows- How to configure node specific setting

This is background for my question.
I have setup distributed Jenkins where the master is running in RHEL linux box and slave is running on a windows box. I did not have any problem in registering the slave node to the master.
In master Jenkins, under manage Jenkins page, I have provided the maven path detail corresponds to master (/opt/maven3).
Now I have create maven2/3 job and assigned the job exclusively on slave node. But when slave is running the maven job on windows, it is taking the maven path installed the master (/opt/maven3), since this path is not valid in windows, throws up an error.
I tried to override the value with pre-build steps, setting M2_HOME and PATH environment entries. but in vein.
So in simple term, How do I configure the node specific settings in Jenkins?
Mean I want to specify in Node 1- Maven path is XXX/maven3 and in node-2 maven path is yyy/zzz/maven3.
Override the settings as follows:
System Management -> Node Management -> your slave setting -> Node Properties -> check the Tools Locations -> Add , then set the slave maven option,alias select "maven",directory write with the slave maven directory.
you can try it.

Resources