NashTech Blog

Jenkins Operator in kubernetes cluster(Part 2)

Table of Contents

As In Part 1 we’ve seen to create jenkins instance using jenkins-operator and the same way. we’ll see in this blog to create the another jenkins instance named as secondjenkins and After that we’ll see how to delete both instances using simple commands in kubernetes cluster.

Now how about creating another Jenkins instance by using jenkins-operator?

So for that if you look at the manifest below for deploying.

https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/deploying-jenkins/

Copy that except  the seed jobs.Basically seed jobs if you’re used to jenkins so seed jobs are like to additional jobs for example:

If you’ve got 50 or 100 jenkins jobs. so you don’t have to create all those manually , once you’ve launched your first jenkins instance the way it works is ,

all the jobs you configure them as you write those jobs, and store them as text files (configuration files) ,

and then seed jobs will read those configurations files and then create those jobs for you.

it’s basically configuration as code.

$ sudo nano /tmp/secondjenkins.yaml

Change example to secondjenkins:

Jenkins Operator kubernetes cluster
  • $ kubectl get pods

Again same process to logged in to secondjenkins after provided username and password for that,

we’ve to chnage the service named as jenkins-operator-credentials-jenkins to jenkins-operator-credentials-secondjenkins as listed below..

Jenkins Operator kubernetes cluster
Jenkins Operator kubernetes cluster

So if you want to the both jenkins instances , use below commands..

$ kubectl get pods $ kubectl delete jenkins secondjenkins $ kubectl delete jenkins jenkins

Jenkins Operator kubernetes cluster

So as we can see both jenkins and secondjenkins instances are delete and we can also verify the secrets get delete or not.

$ kubectl get secrets

$ helm list

Conclusion:

Now we’re back to just having jenkins-operator so

this is how you can manage jenkins instances using jenkins-operator , in the kubernetes cluster.

Jenkins-operator is also able to backup and restore for that , you need to have persistent volume enabled,

and dynamic persistent volume storage provisioning enabled.

Picture of Aditya Kumar Singh

Aditya Kumar Singh

Test Automation Consultant

Leave a Comment

Your email address will not be published. Required fields are marked *

Suggested Article

Scroll to Top