# Remote Agent Can't Connect to Jenkins Controller (HELM)

**URL:** <https://community.jenkins.io/t/remote-agent-cant-connect-to-jenkins-controller-helm/6357>\
**Category:** Using Jenkins\
**Created:** [March 19, 2023, 6:33am UTC](https://community.jenkins.io/t/remote-agent-cant-connect-to-jenkins-controller-helm/6357 "2023-03-19T06:33:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![khaled](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/khaled/32/3676_2.png) [@khaled](https://community.jenkins.io/u/khaled)\
**Post date:** [March 19, 2023, 6:33am UTC](https://community.jenkins.io/t/remote-agent-cant-connect-to-jenkins-controller-helm/6357/1 "2023-03-19T06:33:59Z")

</div>

Hello,

I have a local Kubernetes cluster with Jenkins installed using [HELM chart](https://github.com/jenkinsci/helm-charts), and it works perfectly to build my projects. My current problem is that I’m trying to add another Kubernetes cloud (AWS EKS), and after spinning the Jenkins agent on the remote cluster, it fails to connect to the controller even with WebSocket enabled.

```auto
INFO: Using /home/jenkins/agent/remoting as a remoting work directory
Mar 19, 2023 7:12:34 AM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
INFO: Both error and output logs will be printed to /home/jenkins/agent/remoting
Mar 19, 2023 7:12:35 AM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: Handshake error.
io.jenkins.remoting.shaded.jakarta.websocket.DeploymentException: Handshake error.
	at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.ClientManager$3$1.run(ClientManager.java:658)
	at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.ClientManager$3.run(ClientManager.java:696)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.ClientManager$SameThreadExecutorService.execute(ClientManager.java:849)
	at java.base/java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
	at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:493)
	at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:337)
	at hudson.remoting.Engine.runWebSocket(Engine.java:678)
	at hudson.remoting.Engine.run(Engine.java:499)
Caused by: io.jenkins.remoting.shaded.org.glassfish.tyrus.core.HandshakeException: Response code was not 101: 400.
	at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.TyrusClientEngine.processResponse(TyrusClientEngine.java:301)
	at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.ClientFilter.processRead(ClientFilter.java:167)
	at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.Filter.onRead(Filter.java:111)
	at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.Filter.onRead(Filter.java:113)
	at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.SslFilter.handleRead(SslFilter.java:402)
	at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.SslFilter.processRead(SslFilter.java:365)
	at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.Filter.onRead(Filter.java:111)
	at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.Filter.onRead(Filter.java:113)
	at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.TransportFilter$4.completed(TransportFilter.java:295)
	at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.TransportFilter$4.completed(TransportFilter.java:279)
	at java.base/sun.nio.ch.Invoker.invokeUnchecked(Unknown Source)
	at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishRead(Unknown Source)
	at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(Unknown Source)
	at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(Unknown Source)
	at java.base/sun.nio.ch.EPollPort$EventHandlerTask.run(Unknown Source)
	at java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
2023-03-19T07:12:35.244550207Z

```

I have already enabled WebSocket in the HELM values.

```auto
agent:
    websocket: true

```

Anything else I’m missing?

---

<div class="post-metadata">

**Author:** ![poddingue](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/poddingue/32/985_2.png) [@poddingue](https://community.jenkins.io/u/poddingue)\
**Post date:** [March 19, 2023, 6:19pm UTC](https://community.jenkins.io/t/remote-agent-cant-connect-to-jenkins-controller-helm/6357/2 "2023-03-19T18:19:24Z")

</div>

It seems like there is an issue with the handshake between the Jenkins agent and the controller running on the Kubernetes cluster. Here are a few things you can check:

1. Make sure that the Jenkins controller is reachable from the agent’s network. You can try pinging the controller from the agent’s shell to verify this.
2. Verify that the agent is configured correctly. You can check the Kubernetes pod logs to see if there are any errors or warnings. Make sure that the agent pod has access to the Kubernetes cluster, and that the necessary permissions are granted.
3. Check the network policies and firewall rules in the Kubernetes cluster. Make sure that the agent pod is allowed to communicate with the controller. You can try temporarily disabling any network policies or firewalls to see if this resolves the issue.
4. If the above steps don’t help, you can try increasing the log level for the Jenkins agent by adding the following line to your `values.yaml` file:

```yaml
agent:
  arguments: -Djava.util.logging.config.file=/var/jenkins_home/log.properties

```

Then, create a log.properties file with the following content:

```auto
handlers=java.util.logging.ConsoleHandler
.level=ALL
java.util.logging.ConsoleHandler.level=ALL

```

This should enable verbose logging for the Jenkins agent, which may help you identify the root cause of the issue.

---

<div class="post-metadata">

**Author:** ![Gaurav1](https://avatars.discourse-cdn.com/v4/letter/g/ee59a6/32.png) [@Gaurav1](https://community.jenkins.io/u/Gaurav1)\
**Post date:** [December 28, 2023, 6:33am UTC](https://community.jenkins.io/t/remote-agent-cant-connect-to-jenkins-controller-helm/6357/3 "2023-12-28T06:33:51Z")

</div>

Hi, How you solve this error I also face same error my pods run on eks and jenkins runs on ec2.  
Thanks
