<p>I am using jenkins master-slave model to build a project in kubernetes(install using helm), this is my simple build script to compile the java project:</p>
<pre><code>#!/usr/bin/env bash


set -u

set -e

set -x

./gradlew clean :eureka-service:build -x test
</code></pre>
<p>when I execute this build script in jenkins slave node, shows error:</p>
<pre><code>Started by user admin
Running as SYSTEM
Agent default-j0463 is provisioned from template default
---
apiVersion: &quot;v1&quot;
kind: &quot;Pod&quot;
metadata:
  labels:
    jenkins/jenkins-jenkins-slave: &quot;true&quot;
    jenkins/label: &quot;jenkins-jenkins-slavex&quot;
  name: &quot;default-j0463&quot;
spec:
  containers:
  - args:
    - &quot;********&quot;
    - &quot;default-j0463&quot;
    env:
    - name: &quot;JENKINS_SECRET&quot;
      value: &quot;********&quot;
    - name: &quot;JENKINS_TUNNEL&quot;
      value: &quot;jenkins-agent:50000&quot;
    - name: &quot;JENKINS_AGENT_NAME&quot;
      value: &quot;default-j0463&quot;
    - name: &quot;JENKINS_NAME&quot;
      value: &quot;default-j0463&quot;
    - name: &quot;JENKINS_AGENT_WORKDIR&quot;
      value: &quot;/home/jenkins&quot;
    - name: &quot;JENKINS_URL&quot;
      value: &quot;http://jenkins.infrastructure.svc.cluster.local:8080&quot;
    image: &quot;jenkins/jnlp-slave:3.27-1&quot;
    imagePullPolicy: &quot;IfNotPresent&quot;
    name: &quot;jnlp&quot;
    resources:
      limits:
        memory: &quot;512Mi&quot;
        cpu: &quot;512m&quot;
      requests:
        memory: &quot;512Mi&quot;
        cpu: &quot;512m&quot;
    tty: false
    volumeMounts:
    - mountPath: &quot;/home/jenkins&quot;
      name: &quot;workspace-volume&quot;
      readOnly: false
    workingDir: &quot;/home/jenkins&quot;
  nodeSelector:
    kubernetes.io/os: &quot;linux&quot;
  restartPolicy: &quot;Never&quot;
  serviceAccount: &quot;default&quot;
  volumes:
  - emptyDir:
      medium: &quot;&quot;
    name: &quot;workspace-volume&quot;

Building remotely on default-j0463 (jenkins-jenkins-slave) in workspace /home/jenkins/workspace/eureka-service
Installer &quot;Extract *.zip/*.tar.gz&quot; cannot be used to install &quot;jdk11&quot; on the node &quot;default-j0463&quot;
No credentials specified
Installer &quot;Extract *.zip/*.tar.gz&quot; cannot be used to install &quot;jdk11&quot; on the node &quot;default-j0463&quot;
Cloning the remote Git repository
Cloning repository https://github.com/jiangxiaoqiang/retire.git
 &gt; git init /home/jenkins/workspace/eureka-service # timeout=10
Fetching upstream changes from https://github.com/jiangxiaoqiang/retire.git
 &gt; git --version # timeout=10
 &gt; git --version # 'git version 2.11.0'
 &gt; git fetch --tags --progress -- https://github.com/jiangxiaoqiang/retire.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 &gt; git config remote.origin.url https://github.com/jiangxiaoqiang/retire.git # timeout=10
 &gt; git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
 &gt; git config remote.origin.url https://github.com/jiangxiaoqiang/retire.git # timeout=10
Fetching upstream changes from https://github.com/jiangxiaoqiang/retire.git
 &gt; git fetch --tags --progress -- https://github.com/jiangxiaoqiang/retire.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 &gt; git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 &gt; git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Installer &quot;Extract *.zip/*.tar.gz&quot; cannot be used to install &quot;jdk11&quot; on the node &quot;default-j0463&quot;
Checking out Revision 370d36c72460362fad2d21135d68963b3ec8ff75 (refs/remotes/origin/master)
 &gt; git config core.sparsecheckout # timeout=10
 &gt; git checkout -f 370d36c72460362fad2d21135d68963b3ec8ff75 # timeout=10
Commit message: &quot;[feature] tweak&quot;
 &gt; git rev-list --no-walk 370d36c72460362fad2d21135d68963b3ec8ff75 # timeout=10
Installer &quot;Extract *.zip/*.tar.gz&quot; cannot be used to install &quot;jdk11&quot; on the node &quot;default-j0463&quot;
[eureka-service] $ /bin/sh -xe /tmp/jenkins4274366632085338330.sh
+ cd /home/jenkins/workspace/eureka-service/eureka-service
+ ./script/docker-deploy-impl.sh
+ ./gradlew clean :eureka-service:build -x test
Downloading https://services.gradle.org/distributions/gradle-6.5.1-bin.zip
.........10%..........20%..........30%..........40%.........50%..........60%..........70%..........80%.........90%..........100%

Welcome to Gradle 6.5.1!

Here are the highlights of this release:
 - Experimental file-system watching
 - Improved version ordering
 - New samples

For more details see https://docs.gradle.org/6.5.1/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)
FATAL: command execution failed
java.nio.channels.ClosedChannelException
    at org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:154)
    at org.jenkinsci.remoting.protocol.impl.NIONetworkLayer.ready(NIONetworkLayer.java:142)
    at org.jenkinsci.remoting.protocol.IOHub$OnReady.run(IOHub.java:795)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused: java.io.IOException: Backing channel 'JNLP4-connect connection from 10.11.125.137/10.11.125.137:45922' is disconnected.
    at hudson.remoting.RemoteInvocationHandler.channelOrFail(RemoteInvocationHandler.java:216)
    at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:285)
    at com.sun.proxy.$Proxy89.isAlive(Unknown Source)
    at hudson.Launcher$RemoteLauncher$ProcImpl.isAlive(Launcher.java:1147)
    at hudson.Launcher$RemoteLauncher$ProcImpl.join(Launcher.java:1139)
    at hudson.tasks.CommandInterpreter.join(CommandInterpreter.java:155)
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:109)
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
    at hudson.model.Build$BuildExecution.build(Build.java:206)
    at hudson.model.Build$BuildExecution.doRun(Build.java:163)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
    at hudson.model.Run.execute(Run.java:1880)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:428)
FATAL: Unable to delete script file /tmp/jenkins4274366632085338330.sh
java.nio.channels.ClosedChannelException
    at org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:154)
    at org.jenkinsci.remoting.protocol.impl.NIONetworkLayer.ready(NIONetworkLayer.java:142)
    at org.jenkinsci.remoting.protocol.IOHub$OnReady.run(IOHub.java:795)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused: hudson.remoting.ChannelClosedException: Channel &quot;hudson.remoting.Channel@52ebddbf:JNLP4-connect connection from 10.11.125.137/10.11.125.137:45922&quot;: Remote call on JNLP4-connect connection from 10.11.125.137/10.11.125.137:45922 failed. The channel is closing down or has closed down
    at hudson.remoting.Channel.call(Channel.java:991)
    at hudson.FilePath.act(FilePath.java:1069)
    at hudson.FilePath.act(FilePath.java:1058)
    at hudson.FilePath.delete(FilePath.java:1543)
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:123)
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
    at hudson.model.Build$BuildExecution.build(Build.java:206)
    at hudson.model.Build$BuildExecution.doRun(Build.java:163)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
    at hudson.model.Run.execute(Run.java:1880)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:428)
Build step 'Execute shell' marked build as failure
FATAL: Channel &quot;hudson.remoting.Channel@52ebddbf:JNLP4-connect connection from 10.11.125.137/10.11.125.137:45922&quot;: Remote call on JNLP4-connect connection from 10.11.125.137/10.11.125.137:45922 failed. The channel is closing down or has closed down
java.nio.channels.ClosedChannelException
    at org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:154)
    at org.jenkinsci.remoting.protocol.impl.NIONetworkLayer.ready(NIONetworkLayer.java:142)
    at org.jenkinsci.remoting.protocol.IOHub$OnReady.run(IOHub.java:795)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused: hudson.remoting.ChannelClosedException: Channel &quot;hudson.remoting.Channel@52ebddbf:JNLP4-connect connection from 10.11.125.137/10.11.125.137:45922&quot;: Remote call on JNLP4-connect connection from 10.11.125.137/10.11.125.137:45922 failed. The channel is closing down or has closed down
    at hudson.remoting.Channel.call(Channel.java:991)
    at hudson.Launcher$RemoteLauncher.kill(Launcher.java:1083)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:510)
    at hudson.model.Run.execute(Run.java:1880)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:428)
Finished: FAILURE
</code></pre>
<p>I am already trying the test command and shows the podtemplate connection is success.I am trying to increse the podtemplate memory to 512MB,the project is small and only have few code.where is the problem and what should I do to fix?</p>

Dolphin
<p>I finally find out is the resource is not enough for build. so I tweak config and increse the template pod resource from 512Mi to 1024Mi:</p>
<pre><code>* Request Memory:1024Mi
* Limit Memory:1024Mi
</code></pre>
<p>works.</p>
