I noticed that when using the
container step, my build is getting slower.
- CloudBees CI (CloudBees Core) on modern cloud platforms - Managed Master
- CloudBees CI (CloudBees Core) on traditional platforms - Client Master
- CloudBees Jenkins Platform - Client Master
- CloudBees Jenkins Distribution
- Jenkins LTS
container step introduces an overhead because internally it is directly using the Kubernetes API to run commands
(while without it, only the remoting protocol is used).
This has two implications:
containerstep makes Kubernetes API call, it can be limited by the Max connections to Kubernetes API.
This value is set to 32 by default and you can increase it in the Cloud Configuration (under
The step uses a buffer to send commands to the container.
In versions older than 1.27.0 of the Kubernetes Plugin the size of this buffer was 2kb by default.
This could lead to fragmentation of calls (and therefore slowness) in some cases.
From 1.27.0 onward, the size of the buffer was bumped to 16kb by default.
It should fix this slowness.
In case you cannot bump the Kubernetes Plugin to version 1.27.0 or greater, you can manually set up the buffer size with:
Please review How to add Java arguments to Jenkins?
if you need help adding an argument to Jenkins.
- Jenkins 2.235.x with the Kubernetes Plugin version 1.26.4 (for the workaround).