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.
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:
- $ 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..
So if you want to the both jenkins instances , use below commands..
$ kubectl get pods $ kubectl delete jenkins secondjenkins $ kubectl delete jenkins jenkins
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
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.