简体   繁体   中英

Missing jobs in jenkins when kubernetes deployment have many replicas

I have a deployment of jenkins in kubernetes with 2 replicas, exposed as a service under the nginx-ingress. After creating a project, the next refresh would yield no result for it, as if it was never created, the third refresh would show the created project again.

New to jenkins and kubernetes so not really sure what is happening.

Maybe each time the service is routing to different pods and so just one of the have the project created and other none. If this is the case how could i fix it??

PD: I reduce the replica to 1 and it work as intended but I am trying to make this a failure tolerant project.

To my knowledge Jenkins doesn't support HA by design. You can't scale it up just by adding more replicas. Here is simmilar question to yours on stack overflow .

Nginx is load balancing between two replicas of jenkins instances you created. These two instances are not aware of each other and have separate data so you alternate between two totally separate jenkins instances.

One way you can try solving this is by setting session affinity on the ingress object:

nginx.ingress.kubernetes.io/affinity-mode: cookie

so in this way your browser session sticks to one pod.

Also remember to share $JENKINS_HOME dir between these pods eg using NFS volumes.

And let me know if you find this helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM