Closing Kubernetes Client with Fabric8

3/9/2018

I am using the Fabric8 Java library to access the Kubernetes API within an actor system. I am concerned about connection leaks and want to understand how the client connections are closed underneath after a REST call is made

Here is the code that initializes the client:

config = new ConfigBuilder()
  .withMasterUrl(apiServer)
  .withOauthToken(token)
  .withTrustCerts(true)
  .build();
client = new DefaultKubernetesClient(config);

This client is then passed on to various actors, how should I be closing these connections in the actors so that connections don't leak or are abandoned hen a certain actor dies?

-- user_mda
akka
asynchttpclient
fabric8
java
kubernetes

2 Answers

3/13/2018

The client object has a close method on it.

So, it should be something like client.close().

-- iocanel
Source: StackOverflow

3/9/2018

ReST is the underlying protocol. There's no persistent connection to the server when you create the client. It's only there to help keep configuration together for the calls.

-- Lev Kuznetsov
Source: StackOverflow