d***@gebit.de
2018-11-22 15:03:22 UTC
Hi all,
I am working on a kubernetes cluster for Jenkins. I quickly found Carlos
Sanchez' kubernetes-plugin and started using and adapting it.
The plugin creates "bare" Pods directly in kubernetes, watches and in the
end deletes them after the agent process inside the Pod terminated.
I think there are several issues with this:
a) bare Pods do not get rescheduled in failover cases, for example node
crash
b) kubernetes-plugin is responsible for deleting such a bare Pod (because
Pods are designed to never terminate). If Jenkins (or the node its running
on)
crashes while terminating the slave, it might never actually delete the Pod.
c) kubernetes-plugin immediately deletes the Pod after the build inside the
container is finished. If something else is happening inside the Pod after
the build (e. g. cleanup or syncing), it has no chance of completing.
While researching, I found out that kubernetes provides a "Job" object that
runs a certain amount of containers until successful completion.
Using a kubernetes Job to schedule builds onto the cluster seems to solve
all my aforementioned issues.
a) a Job ensures that the specified number of completed runs are achieved,
even in case of failover
b) and c) a Job automatically deletes all associated Pods when it gets
deleted (and finished Jobs themselves can get auto-deleted with
the new alpha feature TTLAfterFinished in k8s v1.12). This frees the
kubernetes-plugin from caring for the Pods after build completion.
Has anyone experience with kubernetes Jobs? Am I missing something obvious?
@Carlos Sanchez: If not, I would try to implement this in your
kubernetes-plugin. Would you be interested to get this back into your
mainline? Then I would fork the github repo and start directly off master.
Regards,
Daniel
I am working on a kubernetes cluster for Jenkins. I quickly found Carlos
Sanchez' kubernetes-plugin and started using and adapting it.
The plugin creates "bare" Pods directly in kubernetes, watches and in the
end deletes them after the agent process inside the Pod terminated.
I think there are several issues with this:
a) bare Pods do not get rescheduled in failover cases, for example node
crash
b) kubernetes-plugin is responsible for deleting such a bare Pod (because
Pods are designed to never terminate). If Jenkins (or the node its running
on)
crashes while terminating the slave, it might never actually delete the Pod.
c) kubernetes-plugin immediately deletes the Pod after the build inside the
container is finished. If something else is happening inside the Pod after
the build (e. g. cleanup or syncing), it has no chance of completing.
While researching, I found out that kubernetes provides a "Job" object that
runs a certain amount of containers until successful completion.
Using a kubernetes Job to schedule builds onto the cluster seems to solve
all my aforementioned issues.
a) a Job ensures that the specified number of completed runs are achieved,
even in case of failover
b) and c) a Job automatically deletes all associated Pods when it gets
deleted (and finished Jobs themselves can get auto-deleted with
the new alpha feature TTLAfterFinished in k8s v1.12). This frees the
kubernetes-plugin from caring for the Pods after build completion.
Has anyone experience with kubernetes Jobs? Am I missing something obvious?
@Carlos Sanchez: If not, I would try to implement this in your
kubernetes-plugin. Would you be interested to get this back into your
mainline? Then I would fork the github repo and start directly off master.
Regards,
Daniel
--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/1fe306b4-f8f6-48b1-a98a-087b119f880f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/1fe306b4-f8f6-48b1-a98a-087b119f880f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.